cloning generator iterators

Bernhard Mulder bwm at acm.org
Sat Aug 19 19:53:53 EDT 2006


Oops. Got the indentation wrong. Here is the corrected version:

     def generator(self):
         while True:
             while True:
                 if (yield 1):
                    if (yield 1):
                       break
             self.n = 2
             while (yield self.n):
                self.n += 1



More information about the Python-list mailing list