Any other Python flaws?

Carsten Geckeler uioziaremwpl at spammotel.com
Sun Jun 17 03:53:45 EDT 2001


On 14 Jun 2001, 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")

This has nothing to do with "mandatory" or optional.  This is a question
of operator precedence.  The "%" operator has higher precedence as the ","
operator, so grouping with (..) is necessary.

Cheers, Carsten
-- 
Carsten Geckeler





More information about the Python-list mailing list