Python 'object' type and inheritance
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping
--
Chapters
00:00 Python 'Object' Type And Inheritance
00:35 Accepted Answer Score 9
01:06 Answer 2 Score 2
01:27 Answer 3 Score 2
01:45 Thank you
--
Full question
https://stackoverflow.com/questions/1540...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #inheritance #object
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping
--
Chapters
00:00 Python 'Object' Type And Inheritance
00:35 Accepted Answer Score 9
01:06 Answer 2 Score 2
01:27 Answer 3 Score 2
01:45 Thank you
--
Full question
https://stackoverflow.com/questions/1540...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #inheritance #object
#avk47
ACCEPTED ANSWER
Score 9
Inheriting from object makes a class a "new-style class". There is a discussion of old-style vs. new-style here: What is the difference between old style and new style classes in Python?
As @CrazyJugglerDrummer commented below, in Python 3 all classes are "new-style" classes. In Python 3, the following two declarations are exactly equivalent:
class A(object):
pass
class A:
pass
ANSWER 2
Score 2
The first creates an "old-style" class, which are deprecated and have been removed in Python 3. You should not use it in Python 2.x. See the documentation for the Python data model.
ANSWER 3
Score 2
Old style and new style objects... they have sightly different behaviours, for example in the constructors, or in the method resolution order in multiple inheritance.