iterator clone

Peter Otten __peter__ at web.de
Sun Jul 13 03:12:03 EDT 2008


Yosifov Pavel wrote:

> Whats is the way to clone "independent" iterator? I can't use tee(),
> because I don't know how many "independent" iterators I need. copy and
> deepcopy doesn't work...

There is no general way. For "short" sequences you can store the items in a
list which is also the worst-case behaviour of tee().

What are you trying to do?

Peter




More information about the Python-list mailing list