Multiline lamba implementation in python.

Kay Schluehr kay.schluehr at gmx.net
Wed Jun 13 00:30:31 EDT 2007


On 12 Jun., 20:17, George Sakkis <george.sak... at gmail.com> wrote:
> On Jun 12, 11:36 am, Kay Schluehr <kay.schlu... at gmx.net> wrote:
>
>
>
> > On 12 Jun., 16:54, George Sakkis <george.sak... at gmail.com> wrote:
>
> > > On Jun 12, 10:12 am, Kay Schluehr <kay.schlu... at gmx.net> wrote:
>
> > > > On 12 Jun., 14:57, Facundo Batista <facu... at taniquetil.com.ar> wrote:
>
> > > > > Remember that the *only* difference between the two functions is that
> > > > > one is anonymous, and for other you have to came up with a name (name
> > > > > that if is well thought, actually adds readibility to your code).
>
> > > > The difference is that one can be inlined since it is an expression
> > > > and the other has to be a statement and a reusable ( named )
> > > > abstraction even when you don't need one. I have a very hard time to
> > > > defend this as a good design decision even when it is just a minor
> > > > pain point in almost all my practical purposes.
>
> > > I think of it more as a "necessary evil" rather than a conscious
> > > design choice. IIRC the "official" justification is that nobody came
> > > up with an acceptable syntax for multiline lambdas;
>
> > Translating this into unofficial language: Guido just didn't care a
> > lot about lambda and found no one of the alternative proposals
> > compelling. If he's actually interested in a language feature he fixes
> > syntax quite fast.
>
> > > TOOWTDI is a
> > > secondary reason (as one can easily come up with a dozen TOOWTDI
> > > violations in other parts of the language). I agree though that in
> > > practice it's a very small limitation.
>
> > > George
>
> > But in the case we are discussing here it is really not obvious.
> > That's why the community as well as the public opinion when discussing
> > Python returns to the topic every once in a while. We agree about this
> > issue being a minor limitation but I'd vote nevertheless +1 for either
> > removing lambda or liberating it from the restriction of containing an
> > expressions only.
>
> Here we disagree; I prefer the crippled* lambda that covers the
> majority of my needs for inlined functions anyway than the purist all-
> or-nothing approach. YMMV.

If you'd design a new language, George, would you introduce a crippled
lambda because it "fits my needs"? Note we can focus on Python 3.0
which can be regarded as a new programming language following the
assumption of eliminating warts of an older one.




More information about the Python-list mailing list