grandparent method with super

Martin Manns mmanns at gmx.de
Thu Apr 5 16:38:45 EDT 2007


On Thu, 5 Apr 2007 16:33:37 -0400
"John Clark" <clajo04 at mac.com> wrote:

> Pretty sure you can do this:
> 
> class A(object):
> 	def m(self):
> class B(A):
> 	def m(self):
> class C(A):
> 	def m(self):
> class D(B,C):
> 	def m(self):
> 		A.m(self)
>  
> I don't think you want to try to use super() in this case.

That works, but when I replace A with something else, I do not get the
grandparent anymore without changing all the method calls. Basically, I
would like to call the method m in the first grandparent of D.

Martin




More information about the Python-list mailing list