Thursday, October 29, 2015

default class inheritance in python

http://stackoverflow.com/questions/4906014/python-default-inheritance

class Config: vs class Config(object)
------------------------------------

If you define a class and don't declare any specific parent, the class becomes a "classic class", which behaves a bit differently than "new-style classes" inherited from object. See here for more details: http://docs.python.org/release/2.5.2/ref/node33.html

Classic classes don't have a common root, so essentially, your AClass doesn't inherit from any class.

Note that this is specific to Python versions before 3.0. In Python 3, all classes are new-style classes and inherit implicitly from object, if no other parent is declared.

No comments:

Post a Comment