Revision 2 as of 2007-08-31 16:16:39

Clear message

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:

In the table below, the following terminology is used:

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

[http://www.python.org/dev/peps/pep-3135/ New Super]

Catching multiple exceptions

Kuchling, Nowak

[http://www.python.org/dev/peps/pep-3110/ Catching Exceptions in Python 3000]

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

[http://www.python.org/dev/peps/pep-3105/ Make print a function]

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

[http://www.ferg.org/projects/python_gotchas.html#contents_item_1 Backslashes are escape characters]

Ferg

No remedy

[http://www.ferg.org/projects/python_gotchas.html#contents_item_4 Print and softspace]

Ferg

[http://www.python.org/dev/peps/pep-3105/ Make print a function]

[http://www.ferg.org/projects/python_gotchas.html#contents_item_5 Omitting parentheses when invoking a method]

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

Unable to edit the page? See the FrontPage for instructions.