Re: how to access class methods via their name-as-string

2005-01-31 Thread Steven Bethard
[EMAIL PROTECTED] wrote: I'd like to be able to look up a method name by passing a string with the method name. Use getattr: py> class A(object): ... def f(self): ... pass ... def g(self): ... pass ... py> class B(A): ... def h(self): ... pass ... py> getattr(B()

how to access class methods via their name-as-string

2005-01-31 Thread phil_nospam_schmidt
I'd like to be able to look up a method name by passing a string with the method name. I thought I could use self.__dict__ to get at the method names, but as my example shows, this is obviously not working. I've also tried self.__class__.__dict__ without success. Can anyone point me in the right d