[Python-ideas] The Return of Implicit Lambda (Re: Allowing breaks in generator expressions by overloading the while keyword)

Nick Coghlan ncoghlan at gmail.com
Sat Feb 22 00:28:00 CET 2014


On 22 Feb 2014 08:02, "Andrew Barnert" <abarnert at yahoo.com> wrote:
>
> I think the best answer is the one I suggested above--and which I think
Nick implicitly assumed because he's smart enough to get there directly: At
least initially, just do 0-argument and 1-argument lambdas. As long as you
leave the door open for extended syntaxes in a future proposal, we don't
need to figure them out yet.

Yep, the implicit assumption was that the shorthand syntax could get away
with handling just zero-argument functions (for simple callbacks and lazy
evaluation) and one-positional-argument functions (for single object
callbacks, sorting keys and filtering predicates).

More complex cases don't need to be handled, as users have the option to
revert to using an explicit lambda or a named function.

This helps the proposal achieve one of useful heuristics to apply when
judging a new piece of syntactic sugar: in the cases where it applies, it
should be clearly superior to the existing alternatives. Once you get to 2+
arguments, it's hard to be clear without giving them names.

Cheers,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140222/669a150a/attachment.html>


More information about the Python-ideas mailing list