Alternative to multi-line lambdas: Assign-anywhere def statements

Chris Angelico rosuav at gmail.com
Wed Feb 11 22:56:12 EST 2015


On Thu, Feb 12, 2015 at 1:57 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> The reason I don't like this replacing def isn't because the name is
> necessarily lost. It's because the lack of the well-defined def
> statement encourages more complex usages like
>
>     functions['f'] = x -> x**2
>
> where such implicit transformations won't work.

That's actually where this started. I mean, if a function can be
called "<lambda>", why can't it be called "functions['f']"?

ChrisA



More information about the Python-list mailing list