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 significance of the word lambda.

I think there's also just a desire for brevity. In the situations
where it's appropriate to use a lambda, you want something very
compact, and "lambda" is a rather long and unwieldy thing to have
stuck in there.


I hope I am not saying something outrageous now but we used

>>> 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 that can be used to add some attributes later on.


So, my conclusion is, if "()->0" replaces "lambda:0", this very important use-case should still be possible. :-P

Or make "object()" mutable. :-D


[...]
I'm not arguing for or against anything here, just exploring
possible reasons why the idea of lambda-replacement comes up
so often.

I agree the most obvious reason would be that it looks different than in other languages (same for me when I discovered it like 10 years ago).

But as Guido said it's fixed already and I don't think it adds much to the language IMHO. Maybe, I'm too old to see the benefit of changing it.


I like named functions because, well, they have a name attached to them and that makes bug-fixing, debugging, logging, etc. much easier.


Best,
Sven

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/YX7F2WM6QFWCKDRCSZHXAZ5HJ3LOSIMA/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to