[Python-ideas] Python Isn't Perfect: adding a 'gotchas' section to the tutorial

Ned Batchelder ned at nedbatchelder.com
Sat Dec 10 19:34:15 CET 2011

On 12/10/2011 9:16 AM, Richard Prosser wrote:
> Although I love Python there are some aspects of the language design 
> which are disappointing and which can even lead to problems in some cases.
> A classic example is a mutable default argument having the potential 
> to produce unexpected side-effects, as a consequence of the 
> non-intuitive scoping rules.
> Another awkward 'feature' is the requirement for a trailing comma in 
> singleton tuples, due I believe to the use of expression parentheses 
> rather than (say) the use of special brackets like chevrons.
> Something that I personally wish for is the ability to declare 
> variable types 'up front' but that facility is missing from Python.
One of these things is not like the others.  Mutable default arguments, 
and singleton tuples are surprises that make sense once you understand 
things on a deeper level.  It makes sense to call them out as a 
"gotcha": a common stumbling block for learners.  But "no type 
declarations" is not a wart, it's a fundamental feature of the language 
that is immediately apparent from the first lesson.


More information about the Python-ideas mailing list