Author serhiy.storchaka
Recipients ajaksu2, benjamin.peterson, dmalcolm, ezio.melotti, oliver_gramberg, rhettinger, sean_gillespie, serhiy.storchaka
Date 2013-01-10.16:52:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357836764.55.0.703862673369.issue1634034@psf.upfronthosting.co.za>
In-reply-to
Content
>      >>> dict(a = i for i in range(10))
> +    SyntaxError: invalid syntax - ')' expected
>
> The () are ok, the message is misleading.

"dict(a = i)" is valid syntax, the compiler expects ")" instead of invalid "for".

> 'name' here is a bit vague.

The compiler actually expects a name (using Python terminology, see for example NameError). Of course you can propose an other name for "name" (this is just an entity in _PyParser_TokenDescs array).

>  >>> def f(x, None):
>  ...     pass
> +SyntaxError: invalid syntax - ')' expected
>
>  >>> def f(*None):
>  ...     pass
> +SyntaxError: invalid syntax - ')' expected
>
> Here the () are ok too.

The compiler means "def f(x,)" and "def f(*)", not "def f()" as you possible expects.
History
Date User Action Args
2013-01-10 16:52:44serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, sean_gillespie, ajaksu2, oliver_gramberg, benjamin.peterson, ezio.melotti, dmalcolm
2013-01-10 16:52:44serhiy.storchakasetmessageid: <1357836764.55.0.703862673369.issue1634034@psf.upfronthosting.co.za>
2013-01-10 16:52:44serhiy.storchakalinkissue1634034 messages
2013-01-10 16:52:43serhiy.storchakacreate