On 03/01/2014 04:25, Chris Angelico wrote:
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
I find the above rather funcy :)
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list