[Python-Dev] Use an empty def as a lambda

Ryan rymg19 at gmail.com
Sat Sep 21 19:55:20 CEST 2013

Change def to func? That's the worst idea I've heard yet. Def is already there; why break all existing code just for a word?

"Westley Martínez" <anikom15 at gmail.com> wrote:

>'def' is no more ambiguous than 'lambda', and is in fact more
>for 'def' doesn't lend itself to anything other than the word define,
>whilst 'lambda' can only mean lambda function.  Calling def explicit is
>silly.  It only makes sense because def arbitrarily means a function in
>Python (I'm proposing def become func or proc in Python 4000).
>To call lambda too 'computer sciencey' is equally ridiculous, for pro-
>gramming is a key spawn of computer science.  A programmer needs to
>some knowledge of computer science to program, just like a physicist
>needs knowledge of calculus to understand mechanics.
>> -----Original Message-----
>> From: Python-Dev
>[mailto:python-dev-bounces+anikom15=gmail.com at python.org] On
>> Behalf Of Ben Gift
>> Sent: Thursday, September 19, 2013 1:54 PM
>> To: python-dev at python.org
>> Subject: [Python-Dev] Use an empty def as a lambda
>> 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
>> this way.
>Python-Dev mailing list
>Python-Dev at python.org

Sent from my Android phone with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130921/e254e254/attachment.html>

More information about the Python-Dev mailing list