[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Steven D'Aprano
On Wed, Feb 17, 2021 at 11:13:08AM +1300, Greg Ewing wrote: > On 17/02/21 7:10 am, Steven D'Aprano wrote: > >"It's Greek letter, like pi that you may remember from maths > >class. In some technical computer science, the Greek L, lambda, is used > >as the symbol for functions." > > The most accurat

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Stephen J. Turnbull
Ned Batchelder writes: > "lambda" is unnecessarily obscure. And it should be. It's really only useful as an argument. There's no advantage to foo = (x) -> 1 vs. def foo(x): return 1 except a couple of characters. So what currently looks like some_list.sort(key=lambda e: e[3].

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread M.-A. Lemburg
On 16.02.2021 23:13, Greg Ewing wrote: > On 17/02/21 7:10 am, Steven D'Aprano wrote: >> "It's Greek letter, like pi that you may remember from maths >> class. In some technical computer science, the Greek L, lambda, is used >> as the symbol for functions." > > The most accurate answer seems to be

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Steven D'Aprano
On Wed, Feb 17, 2021 at 01:03:40AM +0400, Abdulla Al Kathiri wrote: > From Wikipedia: > "The term originated as an abstraction of the sequence: single, > couple/double, triple, quadruple, quintuple, sextuple, septuple, > octuple, ..., n‑tuple, …" And that's so obvious in hindsight. Thank you.

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Greg Ewing
On 17/02/21 7:10 am, Steven D'Aprano wrote: Its no more "magic" than tuple, deque, iterator, coroutine, ordinal, modulus, etc, not to mention those ordinary English words with specialised jargon meanings like float, tab, zip, thread, key, promise, trampoline, tree, hash etc. Actually, I think i

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Greg Ewing
On 17/02/21 7:10 am, Steven D'Aprano wrote: "It's Greek letter, like pi that you may remember from maths class. In some technical computer science, the Greek L, lambda, is used as the symbol for functions." The most accurate answer seems to be "Because somebody made a mistake transcribing a mat

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Abdulla Al Kathiri
From Wikipedia: "The term originated as an abstraction of the sequence: single, couple/double, triple, quadruple, quintuple, sextuple, septuple, octuple, ..., n‑tuple, …" > On 16 Feb 2021, at 10:10 PM, Steven D'Aprano wrote: > > And I still > don't know where the word comes from in the first p

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Steven D'Aprano
On Tue, Feb 16, 2021 at 11:38:33AM -0500, Ned Batchelder wrote: > "lambda" is unnecessarily obscure. > > Beginner: "why is it called lambda?" > > Teacher: "Don't worry about it, just use it to define a function" That's a bad answer. A better answer that is more appropriate for nearly everyone

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Paul Moore
On Tue, 16 Feb 2021 at 16:40, Ned Batchelder wrote: > > "lambda" is unnecessarily obscure. > > Beginner: "why is it called lambda?" > > Teacher: "Don't worry about it, just use it to define a function" > > I'm not taking a side on whether to change Python, but let's please not > lose sight of just

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Ned Batchelder
"lambda" is unnecessarily obscure. Beginner: "why is it called lambda?" Teacher: "Don't worry about it, just use it to define a function" I'm not taking a side on whether to change Python, but let's please not lose sight of just how opaque the word "lambda" is. People who know the background

[Python-ideas] Re: Arrow functions polyfill

2021-02-16 Thread Steven D'Aprano
On Tue, Feb 16, 2021 at 04:43:11PM +0100, Sven R. Kunze wrote: > >>> obj = lambda: 0 > > to define an anomyous object without the need to define a class first > (speaking of brevity). > > > "Why?", you may ask. The reason is that: > > >>> obj = object() > > does not create an instance of obj

[Python-ideas] Re: Arrow functions polyfill

2021-02-16 Thread Sven R. Kunze
On 15.02.21 22:42, Greg Ewing wrote: On 16/02/21 6:29 am, Guido van Rossum wrote: I can sympathize with trying to get a replacement for lambda, because many other languages have jumped on the arrow bandwagon, and few Python first-time programmers have enough of a CS background to recognize the

[Python-ideas] Re: Arrow functions polyfill

2021-02-16 Thread Stephen J. Turnbull
Steven D'Aprano writes: > lambda a, b, c: a+b*c > (a, b, c) -> a+b*c Of course, the mathematicians' spelling would be (a, b, c) |-> a+b*c (Don't bother throwing things, I'm already a 5km down the road.) ___ Python-ideas mailing list -- p

[Python-ideas] Re: Conditional with statements

2021-02-16 Thread Rob Cliffe via Python-ideas
On 16/02/2021 05:45, Christopher Barker wrote: Still OT ... But I do think you need to consider not just your editor -- if anyone else is going to read your code. They're not (in any universe I can imagine). Exactly -- the most important thing about style is that it be consist

[Python-ideas] Re: Alternate lambda syntax

2021-02-16 Thread Rob Cliffe via Python-ideas
On 15/02/2021 19:47, Mike Miller wrote: On 2021-02-13 14:33, Christopher Barker wrote: On Fri, Feb 12, 2021 at 1:00 AM Brendan Barnwell mailto:brenb...@brenbarn.net>> wrote:         The only thing that would be better than lambda is a less confusing     keyword. There seems to be a fre