class B1(object): def f(self): print "B1.f" class B2(object): def f(self): print "B2.f" class D(B1, B2): pass d = D() super(B1, d).f() print B1.__mro__
为什么打印上面的代码:
B2.f (<class '__main__.B1'>, <type 'object'>)
而文档http://docs.python.org/2/library/functions.html#super说:
super(type[, object-or-type]): ... The __mro__ attribute of the type lists the method resolution search order used by ... super().
似乎使用的MRO不是super()的“type”参数之一,而是“object-or-type”参数之一。这是Python文档中的错误吗?