noro wrote: > Is it possible to do the following: > > for a certain class: > > ---------------------------- > class C: > > def func1(self): > pass > def func2(self): > pass > def func4(self): > pass > > obj=C() > ---------------------------- > > by some way create a dictionary that look somthing like that: > > d= {'function one': <reference to C.func1()>, \ > 'function two': <reference to C.func2()>, \ > 'function three': <reference to C.func3()>}
Perhaps this: >>> class C: ... def function(self, arg): ... print arg ... >>> obj = C() >>> d = C.__dict__ >>> d['function'](obj, 42) 42 >>> Georg -- http://mail.python.org/mailman/listinfo/python-list