Any other Python flaws?

Martijn Faassen m.faassen at vet.uu.nl
Thu Jun 14 18:33:50 EDT 2001


Andrew Kuchling <akuchlin at mems-exchange.org> wrote:
> 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, and the
> other major one, the type/class dichotomy, might get fixed in 2.2 if
> the descr-branch in CVS turns out well.  (It's neat that the two
> largest ones may both get fixed before 2001 is out.)

> That leaves the remaining warts as minor wibbling about 'do'
> statements, print >>, and the like.  Are there any other flaws that
> should be added?

This may be considered a minor quibble; the mandatory use of () in
case of multiple arguments to the % string interpolation operator:

"%s" % "foo"

"%s %s" % "foo", "bar" # doesn't work right

"%s %s" % ("foo", "bar")

You also don't seem to have listed the single element tuple wart, which
trips me up sometimes in complicated structures (like the luckily now
obsolete old Zope security declaration tuple): ("foo",)

Another minor print wart/weirdness is the trailing ',' to prevent 
a newline. I don't find trailing commas very pretty.

Further things possibly wartlike, though this one never bit me, is
the possibly to assign to None, definitely a weird idea when you
first encounter it.

Um..indented triple quoted multiline docstrings keep their indentation?
It's suprising sometimes, though I don't see how you could do it 
any better way.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list