On Fri, Jan 3, 2014 at 3:14 PM, Roy Smith <r...@panix.com> wrote: > Or turn it into a generator: > That certainly makes your mainline code cleaner...
Cleaner perhaps, but not clearer. Instead of seeing the original function (say, a database retrieve-next call), you see a wrapper and have to go dig to find out what it's actually doing. Unless it's some kind of generic handler, like: def funcinator(func,*args): while True: var = func(*args) if var: yield var else: break while funcinator(cur.getnext): .... But even that would be problematic until it got so thoroughly understood that it's like enumerate() - which is itself still not perfect. ChrisA -- https://mail.python.org/mailman/listinfo/python-list