[Python-Dev] Re: "groupby" iterator

Samuele Pedroni pedronis at bluewin.ch
Wed Dec 3 14:14:57 EST 2003

At 07:00 03.12.2003 -0800, Guido van Rossum wrote:
> > The old lambda would have to be kept around for a while for programs
> > relying on the old semantics, but it could be deprecated, and
> > removed in 3.0.
>I'm not sure that the -> notation is more understandable than lambda;
>it would surely confuse C/C++ programmers who are new to Python.
>Scary thought: how about simply introducing early-binding semantics
>for lambda in 3.0?

that would confuse schemers <wink>

>Another radical idea would be to use an anonymous-block notation like
>Smalltalk and Ruby.  We could use some kind of funky brackets like
>[|...|].  A lambda would require an argument notation too.  I believe
>Ruby uses [|x| x+1] where we would write lambda x: x+1, maybe we could
>use [|x: x+1|].  (I like structure with an explicit close more than
>open ones like lambda.)

I would expect blocks to be blocks, accepting also statements and sharing 
the scope
with the surrounding code, not having early-binding semantics.

Honestly, given the introduction of generator exprs, a substitute 
expression for lambda
with early-binding semantics makes sense. Personally I can see it also as 
meaningful wrt  the statemenent/expression dichotomy in python, and we 
would have early-binding as a general rule for "expressions".

But again I think that a block-like syntax should be used, if at all, for 
real blocks.


More information about the Python-Dev mailing list