has_method

Batista, Facundo FBatista at uniFON.com.ar
Tue Aug 31 09:12:36 EDT 2004


[Gandalf]

#- Does anyone knows how to tell if an object has a method with a given
#- name? How can I access that method?

>>> class C:
        def mymeth(self):
                return

       
>>> c = C()
>>> dir(c)
['__doc__', '__module__', 'mymeth']
>>> c.mymeth
<bound method C.mymeth of <__main__.C instance at 0x009ACBC0>>
>>> 

.	Facundo



More information about the Python-list mailing list