Message179574
> >>> 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. |
|
Date |
User |
Action |
Args |
2013-01-10 16:52:44 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, sean_gillespie, ajaksu2, oliver_gramberg, benjamin.peterson, ezio.melotti, dmalcolm |
2013-01-10 16:52:44 | serhiy.storchaka | set | messageid: <1357836764.55.0.703862673369.issue1634034@psf.upfronthosting.co.za> |
2013-01-10 16:52:44 | serhiy.storchaka | link | issue1634034 messages |
2013-01-10 16:52:43 | serhiy.storchaka | create | |
|