How to decide if a object is instancemethod?

Cosmia Luna cosmius at gmail.com
Wed Mar 14 09:28:58 EDT 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