On 11 September 2013 14:03, Neal Becker <ndbeck...@gmail.com> 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
I guess it's related to the removal of auto-unpacking of arguments. i.e. in 2.x: >>> f = lambda (x, y), z: (x, y, z) >>> f([1, 2], 3) (1, 2, 3) However this was removed in 3.x so >>> f = lambda (x, y), z: (x, y, z) File "<stdin>", line 1 f = lambda (x, y), z: (x, y, z) ^ SyntaxError: invalid syntax Removing that feature would allow a simplification of the lambda syntax that would have no need to admit any kind of brackets. Oscar -- https://mail.python.org/mailman/listinfo/python-list