On Sun, Feb 14, 2021 at 9:33 AM Christopher Barker <[email protected]> wrote: > > On Fri, Feb 12, 2021 at 1:00 AM Brendan Barnwell <[email protected]> > wrote: >> >> >> The only thing that would be better than lambda is a less confusing >> keyword. > > > Is this really what this is all about? removing that word? I do think that > adding a parens around the parameters would make it a bit more clear, but it > currently illegal: > > In [18]: lambda(x, y): x + y > File "<ipython-input-18-0f5b071bce98>", line 1 > lambda(x, y): x + y > ^ > SyntaxError: invalid syntax > >> >> So like "func x: x+2" would be better than "lambda x: x+2". >> That probably won't happen because no one wants to add new keywords. >
It is currently illegal, but in previous Pythons, it was legal, with different semantics. Python 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> (lambda(x,y): x + y)(2, 3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: <lambda>() takes exactly 1 argument (2 given) >>> (lambda(x,y): x + y)([2, 3]) 5 >>> ChrisA _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/W6N4M2GDXG54PJEMTA3QB55SEMFKI6R3/ Code of Conduct: http://python.org/psf/codeofconduct/
