a few extensions for the itertools

Carl Banks pavlovevidence at gmail.com
Mon Nov 20 07:08:21 EST 2006


Steven D'Aprano wrote:
> Worse, because comparing an iterator consumes items, you can easily get
> crazy results like the following:
[snip]

However, that doesn't stop the "in" operator:

>>> a = (x for x in xrange(5))
>>> 3 in a
True
>>> list(a)
[4]

I'm not sure if I like it, but at least it's probably a lot more useful
than icmp.

Carl Banks




More information about the Python-list mailing list