Попробуйте средство help()
, встроенное в интерпретатор. Э.Г.
class X(object):
"""Docstring for an example class."""
def __init__(self):
"""Docstring for X.__init__()."""
pass
def method1(self, x):
"""Docstring for method1()."""
print x
>>> help(X)
Help on class X in module __main__:
class X(__builtin__.object)
| Docstring for an example class.
|
| Methods defined here:
|
| __init__(self)
| Docstring for X.__init__().
|
| method1(self, x)
| Docstring for method1().
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __dict__ = <dictproxy object>
| dictionary for instance variables (if defined)
|
| __weakref__ = <attribute '__weakref__' of 'X' objects>
| list of weak references to the object (if defined)
Это работает практически для всего, например,
>>> help(dir):
Help on built-in function dir in module __builtin__:
dir(...)
dir([object]) -> list of strings
Return an alphabetized list of names comprising (some of) the attributes
of the given object, and of attributes reachable from it:
No argument: the names in the current scope.
Module object: the module attributes.
Type or class object: its attributes, and recursively the attributes of
its bases.
Otherwise: its attributes, its class's attributes, and recursively the
attributes of its class's base classes.