Any other Python flaws?

Robert Roy rjroy at takingcontrol.com
Fri Jun 15 17:48:12 EDT 2001


On 14 Jun 2001 22:33:50 GMT, m.faassen at vet.uu.nl (Martijn Faassen)
wrote:

>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")
>

Would that not allow for more ambiguities than its worth? It would
make nested tuples would be extremely dangerous.

This is clear

 ('this', '%s %s' % ('foo', 'bar'), 'that') 

If I change my format string to '%s %s %s' the interpreter will yell
at me if I do not add an element to my tuple

This is not

 ('this', '%s %s' % 'foo', 'bar', 'that')

If I change my format string as above and fail to add the appropriate
element to the tuple, I have an extremely hard to find bug.

Bob



More information about the Python-list mailing list