[Python-Dev] Re: "groupby" iterator

Guido van Rossum guido at python.org
Wed Dec 3 12:48:05 EST 2003


> >It is also somewhat weak in that it only addresses lambdas with one
> >argument, and only allows a single reference to that argument in the
> >resulting expression, and can't really be made to handle method calls
> >without more gross notational hacks -- even though it *can* be made to
> >handle arbitrary binary and unary operators.
> 
> A minor correction: the Voodoo approach handles fine method calls by
> defining a __call__ method in the Voodoo class; [...]
> 
> lambda x: x.startswith("text")
> This works fine as:
> Voodoo().startswith("text")

Hm.  But the whole point of Voodoo is that the resulting object has a
__call__ method that evaluates the expression for a given argument.
How do you do that?  (I suppose you can do it if you don't do
chaining, but I like the chaining.)

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



More information about the Python-Dev mailing list