On Mon, 19 Aug 2013 16:57:37 +0000, Steven D'Aprano wrote: > def func(x): > ... > > # later > save_func = func > func = lambda x, y: do_stuff(x, 3*y)-4 result = > something_that_calls_func() > func = save_func > > > Nasty, horrible code, yes? But it's nasty and horrible because "func" is > bound to a function, it would be equally nasty and horrible if it was a > data type (a string, a list, an int, a flag, ...) instead.
Oops, I left out a word. It is NOT nasty and horrible specifically because "func" is bound to a function, it would be equally horrible if it were a data type. -- Steven -- http://mail.python.org/mailman/listinfo/python-list