On Tue, Feb 16, 2021, at 23:24, Stephen J. Turnbull wrote:
> except a couple of characters.  So what currently looks like
> 
>     some_list.sort(key=lambda e: e[3].priority)
> 
> would then be
> 
>     some_list.sort(key=(e)->e[3].priority)

Let's not pretend the key argument being keyword-only isn't a wart. Surely this 
would be better if it could be some_list.sort(e->e[3].priority).

> which is shorter but not particularly more readable (and already has a
> familiar meaning in C-like languages).

this side point is an argument in favor of using => instead.

[and if => can be confused with >=, surely so can -> be confused with >-]

> 1.  In a one-line def of the form "def foo([arglist]): return EXPR",
>     "return" may be omitted, and the function returns the value of
>     EXPR (rather than None as currently).  (As a multiline def, EXPR
>     would be presumed to be evaluated for side effects, and 

I would like something like this - it's worth noting that C# [and as someone 
helpfully pointed out, Dart] uses => for this case as well, and the argument 
about the syntax looking bad when a return type annotation is present is, I 
think, overblown - return type annotations are almost never needed for a 
function with a single return statement.
_______________________________________________
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/BHH7EIXT7KSFMBGTSGG6VKWKD55Y2TE4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to