Message179547
When running this script:
things = ['a', 'b']
things.append('c'
for a in things:
print a
I get the following output:
$ python script.py
File "script.py", line 3
for a in things:
^
SyntaxError: invalid syntax
the SyntaxError is very misguiding. The error is in a missing parenthesis after the append call, but the error output points to the colon in the for loop. It got me looking for some invisible characters around the colon (which sometimes do pop up in my IPython notebook in OS X).
Expected behaviour - the interpreter should warn me that I have an unmatched parenthesis or at least give some hint as to what possible tokens were expected instead of a colon to help me identify the faulty expression. It is hard to match all parentheses as it is, let alone when the error caused by them shows up in a different line pointing to a token of a different expression with a very vague description. |
|
Date |
User |
Action |
Args |
2013-01-10 14:09:31 | kermit666 | set | recipients:
+ kermit666 |
2013-01-10 14:09:31 | kermit666 | set | messageid: <1357826971.05.0.673810917447.issue16917@psf.upfronthosting.co.za> |
2013-01-10 14:09:30 | kermit666 | link | issue16917 messages |
2013-01-10 14:09:22 | kermit666 | create | |
|