[Python-ideas] A simple proposal concerning lambda

Jacco van Dorp j.van.dorp at deonet.nl
Thu Aug 23 03:04:46 EDT 2018


I think it would have been better to use def from the start instead of
lambda. The only thing JS does right is using the same "function" keyword
for both of these.

However, changing it now doesn't seem that important to me.

(And I've used lambda's as default argument - I was moving data from one
database to another, and wanted a generic method to switch out column names
that defaulted to the same header. So it became a lambda x:x function by
default, but you can provide any function that takes and returns a string
and change the column names. This was last week.)

And lets be real - adding a new keyword is something to be done extremely
sparingly. lambda could have been avoided by re-using def. And no, it being
the same keyword is an advantage, as they do the exact same - they create a
function. It's the same reason as we use if condition:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180823/89e47432/attachment.html>


More information about the Python-ideas mailing list