[Python-ideas] Thoughts on lambda expressions

Chris Angelico rosuav at gmail.com
Wed Mar 2 19:07:08 EST 2016


On Thu, Mar 3, 2016 at 11:00 AM, Mike Miller <python-ideas at mgmiller.net> wrote:
> Hmm, can't think of a way to get rid of the colon without it looking like a
> generator, but perhaps we could tackle the other issues by letting "def"
> stand in for "lambda":
>
>         lambda x: x.y
>
>         def x: x.y
>
> It's shorter, not an esoteric word, and is analogous to a named function
> definition, reminiscent of javascript.  The lack of name/parens separates it
> from the standard form.  Doable, but of course its pretty late in the game
> to be changing lambda, perhaps in Python 4?

T


More information about the Python-ideas mailing list