3 ms·
Lambda entered Python in 1993: changeset: 1369:89e1e5d9ccbf branch: legacy-trunk user: Guido van Rossum <guido@python.org> date: T
by dalke 11y ago
Lambda entered Python in 1993:
changeset: 1369:89e1e5d9ccbf
branch: legacy-trunk
user: Guido van Rossum <guido@python.org>
date: Tue Oct 26 17:58:25 1993 +0000
summary: * compile.[ch]: support for lambda()
so that's only two years after it was first released, and before it was 1.0. The code was user-contributed, but given the timing and the recollections at http://python-history.blogspot.com/2009/04/origins-of-pythons-functional-features.html http://python-history.blogspot.com/2009/04/origins-of-python... I can't agree that the historical record is compatible with "dragged kicking and screaming to lambda."
(See also http://legacy.python.org/search/hypermail/python-1994q2/0705.html http://legacy.python.org/search/hypermail/python-1994q2/0705... for his views on the topic from 1994.)
Van Rossum doesn't think lambda is important, and would rather not have it in Lisp. He wanted to remove it for Python 3, but there was large opposition to that. See his viewpoint from 2005 at http://www.artima.com/weblogs/viewpost.jsp?thread=98196 http://www.artima.com/weblogs/viewpost.jsp?thread=98196 . After a large debate about alternatives (see https://wiki.python.org/moin/AlternateLambdaSyntax https://wiki.python.org/moin/AlternateLambdaSyntax ) he agreed to keep lambda in 2006 at https://mail.python.org/pipermail/python-dev/2006-February/060415.html https://mail.python.org/pipermail/python-dev/2006-February/0... .
- Psyonic 11y agoWhat a shame it would be if he'd removed it. Pyspark now makes great use of lambdas, and I'd strongly argue that having to name every function argument would be strictly worse.
- dalke 11y agoTk developers have long agreed with you, because it really is easier to say Button(frame, text="abc", command=lambda: self.highlight("abc")) than to make a function for each command. The loose consensus in Python is that lambdas are best when they fit on a line, which is what the examples at http://www.mccarroll.net/blog/pyspark2/index.html http://www.mccarroll.net/blog/pyspark2/index.html do. Otherwise, make a named function. I think arguments like this are one of the main reasons why van Rossum has kept lambda in the language.