[Python-Dev] Re: "groupby" iterator
Christos Georgiou
tzot at sil-tec.gr
Wed Dec 3 12:04:44 EST 2003
Guido van Rossum said:
>> The nasty thing about it is that it smells a bit too much like a
>> clever trick. It's really abusing the syntax to make it mean
>> something different from what it usually means.
>
>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; it can't handle
*function* calls in an elegant way:
lambda x: x.startswith("text")
This works fine as:
Voodoo().startswith("text")
lambda x: math.sin(x)
This needs gross syntax, the following does not work:
math.sin(Voodoo())
--
TZOTZIOY, I speak England very best,
Ils sont fous ces Redmontains! --Harddix
More information about the Python-Dev
mailing list