has_method (solution found)

Gandalf gandalf at geochemsource.com
Tue Aug 31 15:28:54 CEST 2004

Somebody sent me a private e-mail.
It must be common for such silly questions that would just spam the 
list. :-)
I'll write down the final solution anyway.

def getmethod(name):
    methodList = [e for e in dir(self) if callable(getattr(self, e))]
    if name in methodList:
       return getattr(self,name)
       return None

Thanks for all.

   Laci 2.0

More information about the Python-list mailing list