This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kermit666
Recipients kermit666
Date 2013-01-10.14:09:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357826971.05.0.673810917447.issue16917@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-01-10 14:09:31kermit666setrecipients: + kermit666
2013-01-10 14:09:31kermit666setmessageid: <1357826971.05.0.673810917447.issue16917@psf.upfronthosting.co.za>
2013-01-10 14:09:30kermit666linkissue16917 messages
2013-01-10 14:09:22kermit666create