Following are the ways how we declare old and new-style class:
One new-style class inherit from an object or from another new-style class.
class NewStyleClass(object):
Pass
class AnotherNewStyleClass(NewStyleClass):
pass
The old-style class does not inherit from anywhere:-.
class OldStyleClass():
pass
If we see compatibility reasons, classes are still old-style by default.
To create new-style classes we need to specify another new-style class (i.e. a type) as a parent class, or the "top-level type" object if no other parent is needed.
The behavior of old-style classes differs from that of new-style classes in a number of important details in addition to what type returns.
In Python 3 we only have new-style classes.