Python Warts¶
Legacy Wiki Page
This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.
Python Warts¶
Python âwartsâ are things for which people have criticised Python, typically aspects of the language or mechanisms of its implementation, because such aspects either expose certain surprising inconsistencies, are regarded as omissions, or cause irritation for parts of the community in some sense. One goal of Python 3000 was to fix inconsistencies which could not have been fixed earlier due to the backwards compatibility constraints imposed on earlier releases of Python. This page summarises the unfixed warts, pitfalls and âgotchasâ (which are not mere observations) from the following resources and lists Python 3000 remedies, if any:
Andrew Kuchlingâs âPython Wartsâ - now archived
Hans Nowakâs â10 Python pitfallsâ - now archived
Steven Fergâs âPython Gotchasâ - now archived
Mark Lutzâs âWhen Pythons Attackâ - Archive
David Mertzâs âPython elegance and wartsâ, Part 1 and Part 2 - now archived
In the table below, the following terminology is used:
No remedy: while some believe this to be a shortcoming, a lack of wider consensus has resulted in no remedy being pursued
Rejected: the shortcoming in question is regarded as a feature, typically because any attempt to remove it would arguably change the language in a way which would be even more confusing - see PEP 3099 for a list of such requested features
Note that the âWhatâs New in Python 3.0â document also contains a list of changes in Python 3000. One can argue that many of the changes are useful fixes that were too mundane for people to write critiques about.
Shortcoming |
Source |
Python 3000 Remedy |
|---|---|---|
No do statement |
Kuchling |
No remedy |
Local variables and scoping |
Kuchling, Nowak, Lutz |
No remedy |
Calling base class methods |
Kuchling |
|
Catching multiple exceptions |
Kuchling, Nowak |
|
Explicit self in methods |
Kuchling |
Rejected - this would require name declarations |
Doubled underscores for private variables |
Kuchling |
No remedy |
The .join() string method |
Kuchling |
No remedy |
print >> |
Kuchling |
|
Inconsistent indentation |
Nowak |
Rejected - indentation is central to Pythonâs syntax |
The += operator |
Nowak |
No remedy |
Class attributes vs instance attributes |
Nowak |
No remedy |
Mutable default arguments |
Nowak, Ferg, Lutz |
No remedy |
Ferg |
No remedy |
|
Ferg |
||
Ferg, Lutz |
Rejected - taking a reference to a function/method is a feature |
|
Imports and reloading |
Lutz |
No remedy - improved reloading has been considered |
Inconsistent/unpredictable comparisons/ordering |
Mertz |
No remedy |
Deficient sequence support for iterators, generators |
Mertz |
No remedy |
Attribute access mechanism proliferation |
Mertz |
No remedy - Mertz suggests standard decorators |