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@gmail.com> wrote:
'def' is no more ambiguous than 'lambda', and is in fact more ambiguous,
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 have
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@python.org] On
Behalf Of Ben Gift
Sent: Thursday, September 19, 2013 1:54 PM
To: python-dev@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 function
this way.




Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.