As part of creating a class definition, Python adds a number of
special attributes. These are informational in nature, and cannot not be
easily be changed except by redefining the class or function, or
reimporting the module.
-
__name__
-
The class name.
-
__module__
-
The module in which the class was defined.
-
__dict__
-
The dictionary which contains the object's attributes and
methods.
-
__bases__
-
The base classes for this class. These are also called
superclasses.
-
__doc__
-
The documentation string. This is part of the response
produced by the help
function.
Here's an example of how the class docstring is used to produce
the help
results for a class.
import random
print random.Random.__doc__
help(random.Random)