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 ezio.melotti, kermit666, mark.dickinson, serhiy.storchaka
Date 2013-01-10.15:13:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CADg_27_=RmOcu1v5wDzwdGaTjzz8F4=0wT2h=esKwE77UUwXXQ@mail.gmail.com>
In-reply-to <1357827822.07.0.441786306982.issue16917@psf.upfronthosting.co.za>
Content
Yes, sure, I agree with both comments. Fors are a bit disambiguous in
this context in comparison to while loops. But something in the style
of Ezio's explanation might come in handy in the error output.

e.g.

SyntaxError: invalid syntax. "," or ")" expected in the argument list
of the method append, but ':' found instead.

(or the equivalent that's possible on that syntactic tree level)

Something that might explain that it's some sort of list being parsed,
not a for-loop command. It would point the coder in the right
direction, speeding him up.

This would all be a bit simpler if an indent was obligatory after
inserting a newline in the middle of a command. Then this would pass
OK

things.append('c'
    for a in things)

while this would fail

things.append('c'
for a in things)

with a syntax error on the first line, because the second line
would've been interpreted as a new command, not a continuation of the
first one.

I don't know if something like that would be possible, due to some
other aspects, though...

On Thu, Jan 10, 2013 at 3:23 PM, Mark Dickinson <report@bugs.python.org> wrote:
>
> Mark Dickinson added the comment:
>
>> The error is in a missing parenthesis after the append call
>
> Well, that's one *possible* cause of the error.  But fixing that missing parenthesis isn't the only way to make the code correct, and Python doesn't have any reasonable way to guess which of the various possible errors you made or what you intended to write.  For example, the following is valid code:
>
> things = ['a', 'b']
> things.append('c'
> for a in things)
>
> ----------
> nosy: +mark.dickinson
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue16917>
> _______________________________________
History
Date User Action Args
2013-01-10 15:13:32kermit666setrecipients: + kermit666, mark.dickinson, ezio.melotti, serhiy.storchaka
2013-01-10 15:13:32kermit666linkissue16917 messages
2013-01-10 15:13:29kermit666create