Why the super class is empty when define child class?
This question already has an answer here:
In Python 2, not specifying a parent class creates an old-style class. Explicitly inheriting from object
creates a new-style class.
(There is no difference between class Foo
and class Foo()
that I know of. Both just result in an old-style class with no parent.)
In Python 3, all three syntaxes result in a new-style class; there's no difference.
See the following posts:
https://wiki.python.org/moin/NewClassVsClassicClass
What is the difference between old style and new style classes in Python?
上一篇: SQL INSERT INTO与SELECT和INNER JOIN
下一篇: 定义子类时,为什么超类是空的?