[Python-ideas] Multi Statement Lambdas

Chris Angelico rosuav at gmail.com
Sun Oct 21 12:14:50 EDT 2018


On Mon, Oct 22, 2018 at 3:07 AM Andreas Winschu <andrej.wins at gmail.com> wrote:
> Guido had a hard opinion on this, but i hope the python community does not. A powerful general purpose language should not limit itself to one statement in a closure.
> Lets add mutli-statement lambdas to python either with just curly braces or with an indent based machine.
>

Just to be clear here, a *closure* is fully capable of having multiple
statements in it. You can use 'def' inside a function, and it will
create a closure.

Proposals like this stand or fall on the syntax to be used. Can you be
completely specific about exactly what the syntax is that you're
proposing, and give some examples? Don't forget that this is currently
valid code:

func(lambda x: {})

so you'll need to clearly distinguish your block delimiters from
set/dict display.

ChrisA


More information about the Python-ideas mailing list