On 2021-02-13 14:33, Christopher Barker wrote:
On Fri, Feb 12, 2021 at 1:00 AM Brendan Barnwell <brenb...@brenbarn.net <mailto:brenb...@brenbarn.net>> wrote:
             The only thing that would be better than lambda is a less confusing
keyword. There seems to be a frequent objection to the word "lambda" -- personally, I found it cryptic, but it's not hard to remember, and it IS easy to look up. But if you don't like that word, why not "def"? Every place I've tried to use "def" where "lambda" is legal, it's a syntax error. So we could use the same word. Would that be less confusing?


Agreed. It isn't too important at this point, but I'd also skip the punctuation and add an expression version of def:


    def named_function(x, y):
        return x * y

    anonymous_function = def x, y: x * y


Parentheses on the parameter list could be allowed as well.

Javascript has (too much) flexibility in this area, but I wouldn't mind Python loosening slightly to use the keyword it probably should have in the beginning.

-Mike

_______________________________________________
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/YHVQIVD6AZFANODLEBMVLNOTGWKK6GZ3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to