Any other Python flaws?
m.faassen at vet.uu.nl
Mon Jun 18 20:10:30 CEST 2001
Carsten Geckeler <uioziaremwpl at spammotel.com> wrote:
> On 14 Jun 2001, Martijn Faassen wrote:
>> 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.
Sure, so ( and ) is mandatory. :) I know it's due to operator precendence
issues. Doesn't mean it's not something that doesn't bite people. The
actually really weird case is the single element tuple, which you can instead
write as '% foo'. But since single element tuples are a wart by themselves,
this extra magic is necessary. Perhaps a language is possible where
single element tuples actually are single elements, though that may
introduce other warts.
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?
More information about the Python-list