Why the following code gives inconsistent method resolution order
error:
class X(object):
x = 4
def f(self):
print 'f in X'
print dir(X)
X.g(self)
def g(self):
print 'g in X'
class Y(object, X):
def
Ravi wrote:
Why the following code gives inconsistent method resolution order
error:
[...]
Your problem can be reduced to:
class A(object):
... pass
...
A.__mro__
(class '__main__.A', type 'object')
class B(object, A):
... pass
...
Traceback (most recent call last):
File stdin,
Ravi wrote:
Why the following code gives inconsistent method resolution order
error:
class X(object): x = 4 def f(self): print 'f in X' print dir(X)
X.g(self) def g(self): print 'g in X'
class Y(object, X): def g(self): print 'g in Y'
o = Y() o.f()
Calculating a linear MRO from a
On Oct 8, 9:09 pm, Ravi [EMAIL PROTECTED] wrote:
Why the following code gives inconsistent method resolution order
error:
snip
If you want to know all the nitty-gritty details about
the MRO (including the reason for the error you get)
you should read this: