[Python-Dev] Re: "groupby" iterator

Guido van Rossum guido at python.org
Tue Dec 2 14:26:40 EST 2003


> > So, while I'm not particularly keen on lambda, I'm not that keen on
> > attrgetter either.  But what could be better?  All I can think of are
> > slightly shorter but even more crippled forms of lambda; for example,
> > we could invent a new keyword XXX so that the expression (XXX.foo) is
> > equivalent to (lambda self: self.foo).  This isn't very attractive.
> 
> Doesn't have to be a keyword... I implemented something like this
> years ago and then ditched it when list comps appeared.
> 
> It would let you do things like
> 
> >>> map(X + 1, range(2))
> [1, 2, 3]

What was your notation like?  Did you actually use 'X'?

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list