Python – Built-in Class Attributes

Click the link: “Python – Built-in Class Attributes

In this tutorial we will learn about built-in class attributes in Python.

Built-in class attributes gives us information about the class.

We can access the built-in class attributes using the . operator.

Following are the built-in class attributes.

Attribute Description
__dict__ This is a dictionary holding the class namespace.
__doc__ This gives us the class documentation if documentation is present. Noneotherwise.
__name__ This gives us the class name.
__module__ This gives us the name of the module in which the class is defined.

In an interactive mode it will give us __main__.

__bases__ A possibly empty tuple containing the base classes in the order of their occurrence.

Read more…