Daniel Stutzbach <[email protected]> added the comment:
Actually, it's essential to how super() works. Here's an example using
single inheritance:
class A(object):
def foo(self):
print 'A'
class B(object):
def foo(self):
super(B, self).foo()
print 'B'
class C(object):
def foo(self):
super(C, self).foo()
print 'C'
x = C()
x.foo()
The "super" in x.foo() return a proxy for x that skips C.
Next, we call foo() on that proxy, which calls B's foo().
In B's foo(), "self" is the proxy. B's foo() passes the proxy to
super(), returning a new proxy for x that skips C and B. Finally, we
call foo() on the new proxy, which calls A's foo().
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue5229>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com