I am working on Mac OS X v10.10 (Yosemite) with Python 2.7.9.
Here is what I have tried:
Define a class
class A: def test(self): print "test"
Then run
A.__mro__
Then I got
>>> A.__mro__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: class A has no attribute '__mro__'
Then I define
class B(object): def test(self): print "test"
Then run
B.__mro__
Then I got
>>> B.__mro__ (<class '__main__.B'>, <type 'object'>)
What is the different between the two definitions?
I found that in Python 3, the edition without "object" still has the __mro__
method.