Few questions about new features in Python 2.2

Michael Hudson mwh at python.net
Tue Oct 23 06:31:45 EDT 2001


s.keim at laposte.net (sebastien) writes:

> Why iterators can't be copied?

Think about 

>>> i = iter(sys.stdin)
>>> j = iter(i)

when sys.stdin is attached to a pipe.

or iter(iter(g())) for some generator g.

It just ain't possible in general.

Cheers,
M.

-- 
  And then the character-only displays went away (leading to
  increasingly silly graphical effects and finally to ads on
  web pages).                      -- John W. Baxter, comp.lang.python



More information about the Python-list mailing list