Does anyone have code to copy a generator?

Here is what I'd like to do:

def foo():
   yield 1
   yield 2
   yield 3

f = foo()
g = copy(foo)

print f.next()
1
print f.next()
2

print g.next()
1

Thanks,

   Horace
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to