Idioms and Anti-Idioms Question
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Tue Jun 23 11:24:03 EDT 2009
En Mon, 22 Jun 2009 20:34:40 -0300, Miles Kaufmann <milesck at umich.edu>
escribió:
> On Jun 22, 2009, at 12:14 AM, Ben Charrow wrote:
>
>> What is subtly wrong about this piece of code? I can't see any bugs
>> and can't think of subtle gotchas (e.g. the '\' is removed or the lines
>> become separated, because in both cases an IndentationError would be
>> raised).
>
> Perhaps, along with one of those gotchas, a mix of tabs and spaces are
> used such that the second line only _appears_ to have a different level
> of indentation? ;)
Neither. As back in time as I can go (Python 1.5), having any character
after the backslash has always been a syntax error no matter what. Only
the error message has changed:
C:\TEMP>python15 syntaxerror.py
File "syntaxerror.py", line 18
value = foo.bar()['first'][0]*baz.quux(1, 2)[5:9] \
^
SyntaxError: invalid token
So the "it might be subtly wrong" argument is strongly wrong.
--
Gabriel Genellina
More information about the Python-list
mailing list