iterator clone

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Jul 16 06:32:08 CEST 2008


On Tue, 15 Jul 2008 19:54:30 -0700, Yosifov Pavel wrote:

> Kay, can you show example of such generator? ReIter, for example, work
> with usual generators.
> 
> But for "big" iterator, I think is no any good solutions. IMHO we can
> discern 2 types of iterators: re-startable (based on internal Python
> objects) and not re-startable (with an external state, side-
> effects)...

Has nothing to do with internal vs. external.
Examples: ``itertools.count(1)``, ``itertools.cycle(iterable)``, or

def fib():
    a, b = 0, 1
    while True:
        yield a
        a, b = b, a + b

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list