Any, All predicates (and vector operations for free)
Alex Martelli
aleaxit at yahoo.com
Sun Feb 16 11:06:15 EST 2003
Christos TZOTZIOY Georgiou wrote:
...
> I care about speed too; this code actually was written before generators
> initially, and while I have introduced some 2.3 syntax in it, I have not
> yet attempted to turn this into a class using generators... perhaps
> adding a .next method would not be such a bad start :)
>
> Thanks for replying, Alex.
You're welcome! But what you need here is a simple loop -- no generators
needed, really. Speed issues are uncertain -- benchmark things both ways --
but a simple loop is probably going to be *clearer*, and I think that
matters. There are occasions to use generators, of course, but when some
task can be handled just as well without such powerful tools then I believe
that relying on simpler tools can be preferable.
Alex
More information about the Python-list
mailing list