grandparent method with super

John Clark clajo04 at mac.com
Thu Apr 5 16:33:37 EDT 2007


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.

-jdc 

-----Original Message-----
From: python-list-bounces+clajo04=mac.com at python.org
[mailto:python-list-bounces+clajo04=mac.com at python.org] On Behalf Of Martin
Manns
Sent: Thursday, April 05, 2007 4:20 PM
To: python-list at python.org
Subject: grandparent method with super

Hi,

I have a class structure as follows and I would like to invoke the method
A.m() from D.m

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):
		# Call A.m with super?

I have read http://www.python.org/download/releases/2.2/descrintro/ but I am
still stuck.

Thanks in advance

Martin
--
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list