One way to describe a language is by listing its features. Of course, this will be more meaningful after you’ve seen Python in action; the best I can do now is speak in the abstract. And it’s really how Python’s features work together that make it what it is. But looking at some of Python’s attributes may help define it; Table 1-1 lists some of the common reasons cited for Python’s appeal.
Table 1-1. Python language features
Features | Benefits |
---|---|
No manual compile or link steps | Rapid development cycle turnaround |
No type declarations | Simpler, shorter, and more flexible programs |
Automatic memory management | Garbage collection avoids bookkeeping code and errors |
High-level datatypes and operations | Fast development using built-in object types |
Object-oriented programming | Code reuse; C++, Java, COM, and .NET integration |
Embedding and extending in C | Optimization, customization, legacy code, system “glue” |
Classes, modules, exceptions | Modular “programming-in-the-large” support for large-scale projects |
A simple, clear syntax and design | Readability, maintainability, ease of learning, less potential for bugs |
Dynamic loading of C modules | Simplified extensions, smaller binary files |
Dynamic reloading of Python modules | Programs can be modified without stopping |
Universal “first-class” object model | Fewer restrictions, code flexibility |
Runtime program construction | Handles unforeseen needs, end-user coding |
Interactive, dynamic nature | Incremental development and testing |
Access to interpreter information | Metaprogramming, introspective objects |
Wide interpreter portability | Cross-platform programming without per-program ports |
Compilation to portable bytecode | Execution speed, portability |
Standard portable GUI framework | Tkinter scripts run on X, Windows, Macs; alternatives: wxPython, PyQt, etc. |
Standard Internet protocol support | Easy access to email, FTP, HTTP, CGI, Telnet, etc. |
Standard portable system calls | Platform-neutral system scripting and system administration |
Built-in and third-party libraries | Vast collection of precoded software components |
True open source software | May be freely embedded and shipped |
To be fair, Python is really a conglomeration of features borrowed from other languages and combined into a coherent whole. It includes elements taken from C, C++, Modula-3, ABC, Icon, and others. For instance, Python’s modules came from Modula and its slicing operation from Icon (as far as anyone can seem to remember, at least). And because of Guido’s background, Python borrows many of ABC’s ideas but adds practical features of its own, such as support for C-coded extensions. To many, Python’s feature combination seems to be “just right”—it combines remarkable power with a readable syntax and coherent design.
3.144.9.169