Let-expressions

sloisel sloisel at gmail.com
Fri Apr 3 22:35:51 EDT 2009


Thanks for the quick replies.

I didn't want statements in my expressions, just let-expressions.
That's okay, it was just a question.

Sébastien Loisel

On Apr 3, 7:20 pm, Chris Rebert <c... at rebertia.com> wrote:
> On Fri, Apr 3, 2009 at 4:18 PM, Terry Reedy <tjre... at udel.edu> wrote:
> > sloisel wrote:
>
> >> Dear All,
>
> >> I searched this group and found that there have been discussions about
> >> introducing a let expression to the language so that you can define
> >> local variables in a lambda. I.e., something like f=lambda x: let
> >> y=x^2 in sin(y). (My syntax is unpythonic, but I hope you get it).
>
> >> Can someone tell me what eventually happened?
>
> > The discussions ended.
> > Proposals for assignment expressions have been rejected.
>
> To elaborate slightly, if you need anything more complicated than a
> single expression, then *don't use a lambda*. Just use a named
> function. It's much clearer and easier.
> Proposals to extend lambda usually spiral/evolve into wanting to make
> lambda multi-line, which has repeatedly been found to be incompatible
> with Python's indentation-based syntax; and, again, you can just use a
> named function.
>
> Cheers,
> Chris
>
> --
> I have a blog:http://blog.rebertia.com




More information about the Python-list mailing list