Know if a object member is a method
Manuel Ebert
maebert at uos.de
Mon Sep 1 04:52:10 EDT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Luca,
use type(something).__name__ , e.g.
>>> def x():
>>> pass
>>> class C:
>>> pass
>>> c = C()
>>> type(x).__name__ == 'function'
True
>> type(C).__name__ == 'classobj'
True
>> type(c).__name__ == 'instance'
True
On Sep 1, 2008, at 10:43 AM, Luca wrote:
> Hi all.
>
> I think this is a newbie question... what is the best method to know
> if a property of an object is a function?
>
> I'm thinking something as
>
> if type(obj.methodName)==???
>
> Can someone help me?
>
> --
> -- luca
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
iD8DBQFIu606cZ70OCIgLecRAhE6AJ4r0GuHlWxXbLaYuolqpJStYPD+ggCgidKg
qtgl+nbaKgH5AoelTu5WeJU=
=W4eG
-----END PGP SIGNATURE-----
More information about the Python-list
mailing list