i

Python Programming

Built-In Class Attributes

Python class keeps the built-in attributes and they can access using dot operator:

__dict__ − Dictionary containing class name-space.

  • ___doc___−Class string or none.
  • __name___−Class name
  • ___module___−Module name in which class defined. This attribute "__main__" interactive mode.
  • ___bases___−Possibly empty tuple containing base class in order of their occurrence in base class list.

Live Demo

Output:

Emp__doc__: Common base class for all employees

Emp.__name__: Employee

Emp.__module__: __main__

Emp.__bases__: ()

Emp.__dict__: {'__module__': '__main__', 'displayCount':

, 'empcount': 2,

'displayemployee': ,

'__doc__': 'Common base class all employees',

'__init__' }