Serhiy Storchaka added the comment: > >>> 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1634034> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com