Am 21.06.2012 13:25 schrieb John O'Hagan:
But what about a generator?
Yes, but...
def some_func(): arg = big_calculation() while 1: i = yield (do_something with arg and i) some_gen = some_func() some_gen.send(None) for i in lots_of_items: some_gen.send(i)
rather def some_func(it): arg = big_calculation() for i in it: do_something(arg, i) some_func(lots_of_items) HTH, Thomas -- http://mail.python.org/mailman/listinfo/python-list