Big time WTF with generators - bug?

James Stroud jstroud at
Wed Feb 13 09:54:36 CET 2008

Paul Rubin wrote:
> James Stroud <jstroud at> writes:
>> I defined a little debugging function called iterprint:
>> def iterprint(thing): ...
>>        for x in thing:
>>          iterprint(x)
> of course this mutates the thing that is being printed.  Try using
> itertools.tee to fork a copy of the iterator and print from that.
> I didn't look at the rest of your code enough to spot any errors
> but take note of the warnings in the groupby documentation about
> pitfalls with using the results some number of times other than
> exactly once.

Thank you for your answer, but I am aware of this caveat. Something is 
consuming my generator *before* I iterprint it. Please give it another 
look if you would be so kind.

James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

More information about the Python-list mailing list