Special Class Attributes : Introduction « Class « Python Tutorial






C.__name__      String name of class C
C.__doc__      Documentation string for class C
C.__bases__      Tuple of class C's parent classes
C.__dict__      Attributes of C
C.__module__  Module where C is defined (new in 1.5)
C.__class__      Class of which C is an instance (new-style classes only)


class MyClass: pass
print MyClass.__name__
print MyClass.__doc__
print MyClass.__bases__
print MyClass.__dict__
print MyClass.__module__








11.1.Introduction
11.1.1.Common operator overloading methods
11.1.2.Double Underscore __
11.1.3.Special Class Attributes
11.1.4.__dict__ is a dictionary representing its attributes:
11.1.5.Special Instance Attributes
11.1.6.Built-in Type Attributes
11.1.7.Metaclass Example
11.1.8.Related Modules and Documentation