>> If they need to resume their calculations from where they left off >> after the last yield.
Wolfgang> Well, no, independently from that. Wolfgang> Just to avoid to inital overhead of the function call. How do you pass in parameters? Consider: def square(x): return x*x vs def square(x) while True: yield x*x How do you get another value of x into the generator? >>> def square(x): ... while True: ... yield x*x ... >>> g = square(2) >>> g <generator object at 0x3b9d28> >>> g.next() 4 >>> g.next() 4 >>> g.next(3) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: expected 0 arguments, got 1 Skip -- http://mail.python.org/mailman/listinfo/python-list