PEP new assert idiom
Fábio Mendes
niels_bohr at uol.com.br
Sun Nov 7 15:09:33 EST 2004
[...]
>
> Nope, comma can never be used as implicit line continuation in Python
> (that's different from some other languages). The opened and yet
> unclosed parentheses are what cause several physical lines to be part of
> the same logical line -- not commas, nor other operator or punctuation.
>
[...]
> You may be associating "commas continue lines" with "function arguments"
> because function definitions and calls DO use parentheses, and separate
> arguments with commas. But it's really not an ideal mental model.
You're right, that's a subtle misconception that don't give syntax
errors so I never realize to be the case ;-) I was writing multiple line
dictionaries like this:
>>> dic = { \
... key: value
... key2: value2 }
The backslash is completely uncecessary (and ugly!). Thanks for
clarification,
-Fabio
More information about the Python-list
mailing list