How to decide if a object is instancemethod?

Cosmia Luna cosmius at gmail.com
Wed Mar 14 14:28:58 CET 2012


class Foo(object):
    def bar(self):
        return 'Something'

func = Foo().bar

if type(func) == <type 'instancemethod'>: # This should be always true
    pass # do something here

What should type at <type 'instancemethod'>?

Thanks
Cosmia



More information about the Python-list mailing list