On 2021-02-11 03:24, J. Pic wrote:
Hi all,
Lambdas can be defined as such:
w = lambda: [12]
x = lambda y: len(y)
I'd like to propose the following:
w = (): [12]
x = (y): len(y)
Or even another contraction for when there are no arguments:
w =: [12]
I don't see any need for this. It's even more cryptic than "lambda"
because at least lambda is a word you can look up. This is just
inscrutable punctuation. Using different punctuation like "=>" doesn't
help.
The only thing that would be better than lambda is a less confusing
keyword. So like "func x: x+2" would be better than "lambda x: x+2".
That probably won't happen because no one wants to add new keywords.
But adding new non-keyword ways to do this isn't worth it just to save a
few keystrokes.
--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no
path, and leave a trail."
--author unknown
_______________________________________________
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/ZGJ5WAI7YKMPSXWXOKNADRCP44SFR262/
Code of Conduct: http://python.org/psf/codeofconduct/