Any other Python flaws?

Mattias Engdegård f91-men at nada.kth.se
Fri Jun 15 05:32:06 EDT 2001


In <mailman.992543370.22014.python-list at python.org> Andrew Kuchling <akuchlin at mems-exchange.org> writes:

>I was updating my page of possible Python design flaws
>(http://www.amk.ca/python/writing/warts.html) last night to take 2.1
>into account.  2.1's nested scoping fixes one major wart

except that it doesn't do it properly - you still cannot assign to a
variable bound in a surrounding scope, something you can do in *all*
other languages supporting nested scopes. I find this quite frustrating
and it leads to ugly workarounds. (the PEP has a short discussion of this
but doesn't really give a satisfactory explanation of why it's done that way)

>Are there any other flaws that
>should be added?

That anonymous (lambda) functions can only contain an expression, not
statements? Less of a problem, but still ugly and feels like an arbitrary
decision, perhaps because it was too hard to make it fit with python's
unusual indentation-based syntax.

(by the way, your page (Python Warts) claims that python uses
call-by-reference, which is a common misconception. Just like most other
sensible languages (but unlike C++, Fortran, Pascal) it uses call-by-value.
The values, however, are frequently references to objects, which is
probably the cause of the confusion. :-)

Cheers,

	Mattias.




More information about the Python-list mailing list