[Python-Dev] RE: cloning iterators again

Guido van Rossum guido at python.org
Mon Oct 27 13:00:09 EST 2003


> As a proof-of-concept, here is GvR's code re-cast with the queue changed
> to a double stack implementation.  The interface is completely
> unchanged.  The memory consumed is double that the current tee() but
> much less than the linked list version.  The speed is half that of the
> current tee() and roughly comparable to or slightly better than the
> linked list version.

Actually, if I up the range() in the gen() function to range(10000)
and drop the print statement, the Python version of your code runs
about 20% slower than mine.  But this says nothing about the relative
speed of C implementations.

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



More information about the Python-Dev mailing list