How best to dynamically define methods (and functions)?
Erik Max Francis
max at alcyone.com
Sat Sep 1 23:53:33 EDT 2007
Erik Max Francis wrote:
> Something like::
>
> method = ['fun', ...]
> for method in methods:
> setattr(MyClass, method, lambda *x: Node(method, *x))
Err, that first line was supposed to be methods = ...
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
I like young girls. Their stories are shorter.
-- Thomas McGuane
More information about the Python-list
mailing list