On Wed, 11 Sep 2013 09:03:49 -0400, Neal Becker wrote: > In py2.7 this was accepted, but not in py3.3. Is this intentional? It > seems to violate the 'principle' that extraneous parentheses are usually > allowed/ignored > > In [1]: p = lambda x: x > > In [2]: p = lambda (x): x > File "<ipython-input-2-2b94675a98f1>", line 1 > p = lambda (x): x > ^ > SyntaxError: invalid syntax
It is not specific to lambda, it has to do with the removal of argument unpacking in function argument lists: # allowed in Python 2, not in Python 3 def f(a, b, (c, d), e): pass In Python 3, the parser appears to disallow any extra parentheses inside the parameter list, even if strictly speaking they don't do anything: py> def f(a, b, (c), d, e): File "<stdin>", line 1 def f(a, b, (c), d, e): ^ SyntaxError: invalid syntax -- Steven -- https://mail.python.org/mailman/listinfo/python-list