Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Special Attribute Names

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)

 
 
  Published under the terms of the Open Publication License Design by Interspire