Am 25.07.2011 17:28, schrieb Archard Lias:
> It would be great if you could elaborate a little more on that. Am I
> not supposed to access the parent here?
You must spell out the parent explicitly, otherwise subclasses call
super() with themselves rather than the correct parent class.
self.__class__ is too dynamic here. Have a look at this example:
class A(object):
def method(self):
pass
class B(A):
def method(self):
super(self.__class__, self).method()
class C(B):
pass
In this example, C().method() results in "super(C, self).method()"
because self.__class__ is C. However that is wrong because you have to
call super() with the direct parent.
Christian
--
http://mail.python.org/mailman/listinfo/python-list