generating method names 'dynamically'

Farshid Lashkari lashkariNO at
Fri Jan 27 00:47:40 CET 2006

> Is it possible to have method names of a class generated somehow dynamically?

If you don't know the name of the method ahead of time, how do you write 
the code for it? Do you use some dummy name? If so, once you have the 
name determined then you could use setattr to set the method name. 
Here's a simple example:

class MyClass:
     def DummyMethodName(self): pass



More information about the Python-list mailing list