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

2013-09-21 Thread Steven D'Aprano
Guys, this thread is not Python-Dev territory. It should have gone to Python-Ideas. I repeat what I posted two days ago: Proposals for changes to syntax and functionality are normally expected to gather feedback on python-ideas before coming to python-dev for final approval or reject

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

2013-09-21 Thread Westley Martínez
> -Original Message- > From: Python-Dev [mailto:python-dev-bounces+anikom15=gmail@python.org] On > Behalf Of Ben Finney > Sent: Saturday, September 21, 2013 12:56 PM > To: python-dev@python.org > Subject: Re: [Python-Dev] Use an empty def as a lambda > >

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

2013-09-21 Thread Ben Finney
Westley Martínez writes: > My reasoning is that we use class to make classes, lambda to make > lambda functions, and def to make--well not defs--functions, which > doesn't really make sense to me. Your reasoning is flawed. There is no such thing in Python as a “lambda function”. Python has func

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

2013-09-21 Thread Westley Martínez
ift'; python-dev@python.org > Subject: Re: [Python-Dev] Use an empty def as a lambda > > 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" wrote:

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

2013-09-21 Thread R. David Murray
On Sat, 21 Sep 2013 12:55:20 -0500, Ryan wrote: > "Westley Martínez" 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 expli

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

2013-09-21 Thread Ryan
s. > >> -Original Message- >> From: Python-Dev >[mailto:python-dev-bounces+anikom15=gmail....@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 empt

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

2013-09-20 Thread Lennart Regebro
On Thu, Sep 19, 2013 at 10:54 PM, Ben Gift wrote: > I think the lambda keyword is difficult to understand for many people. It > would be more pythonic to use an empty def call instead. I agree, but that ship has sailed, at least until the time when Python 2 is dead. I don't want these kinds of sy

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

2013-09-20 Thread Westley Martínez
rogram, just like a physicist needs knowledge of calculus to understand mechanics. > -Original Message- > From: Python-Dev [mailto:python-dev-bounces+anikom15=gmail@python.org] On > Behalf Of Ben Gift > Sent: Thursday, September 19, 2013 1:54 PM > To: python-dev@python.org &

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

2013-09-19 Thread Steven D'Aprano
On Thu, Sep 19, 2013 at 01:54:08PM -0700, Ben Gift wrote: > I think the lambda keyword is difficult to understand for many people. It > would be more pythonic to use an empty def call instead. Hi Ben, and welcome! Is this your first post? I'm afraid I don't recognise your name. I think this disc

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

2013-09-19 Thread Ryan Gonzalez
Nice idea, BUT... Not sure how a parser addition that supports it would go. Imagine this: if you did a one-line function: def test(x): print(x) Python could interpret it two ways: `def` `name` `lparen` `name` `rparen` `colon`... OR, it could see it as a lambda-like thingamajig and throw a synt

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

2013-09-19 Thread Alexander Belopolsky
On Thu, Sep 19, 2013 at 4:54 PM, Ben Gift wrote: > It would be more pythonic to use an empty def call instead. No, it won't. Python draws a very strong distinction between expressions and statements. This line has been blurred somewhat with the advent of comprehensions and the if-else expres

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

2013-09-19 Thread Joe Pinsonault
I think it's a great idea personally. It's explicit and obvious. "lamda" is too computer sciencey On Sep 19, 2013 1:55 PM, "Ben Gift" wrote: > 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

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

2013-09-19 Thread Ben Gift
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

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

2013-09-19 Thread Nick Coghlan
On 20 Sep 2013 07:04, "Joe Pinsonault" wrote: > > I think it's a great idea personally. It's explicit and obvious. "lamda" is too computer sciencey This suggestion has been made many times, occasionally with the associated "must be contained in parentheses when used as an expression" caveat that

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

2013-09-19 Thread Xavier Morel
On 2013-09-19, at 23:17 , Nick Coghlan wrote: > On 20 Sep 2013 07:04, "Joe Pinsonault" wrote: >> >> I think it's a great idea personally. It's explicit and obvious. "lamda" > is too computer sciencey > > This suggestion has been made many times, occasionally with the associated > "must be conta