[Python-Dev] Use an empty def as a lambda
Ben Gift
benhgift at gmail.com
Thu Sep 19 22:54:08 CEST 2013
I think the lambda keyword is difficult to understand for many people. It
would be more pythonic to use an empty def call instead.
For instance this:
words.sort(key = lambda x: x[2])
could look like this:
words.sort(key = def (x): x[2])
It's obvious and explicit that we're creating an unnamed, anonymous
function this way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130919/0b985608/attachment-0001.html>
More information about the Python-Dev
mailing list