class memebers
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Wed Dec 19 18:27:46 EST 2007
En Wed, 19 Dec 2007 17:17:43 -0300, N L <nl_uc at yahoo.com> escribió:
> How do I list the members of a class? Meaning, how do I know what are
> the functions a particular class has, if i do not want to manually
> browse through the class?
From the interpreter, just print dir(class) or dir(instance); that
includes both attributes and methods. Or use the interactive help:
help(class), help(class.method)
Inside a program, use the inspect module: getmembers() retrieves all
members (both attributes and methods), you can filter that using the
various isXXX() functions.
--
Gabriel Genellina
More information about the Python-list
mailing list