"inherited" keyword in Python?
Niki Spahiev
spahievi at vega.bg
Tue Dec 5 15:39:07 EST 2000
04.12.2000, 17:58:18, Alex Martelli wrote:
AM> "Carsten Gaebler" <cg at schlund.de> wrote in message
AM> news:3A2B9EFA.3A64C13B at schlund.de...
>> Hi there!
>>
>> Does Python know something like the "inherited" keyword from Borland
>> Pascal? In Pascal it is used to call a method of a class's superclass,
>> i.e. instead of saying "superclass.method()" you say "inherited
>> method()". Can be quite helpful if you change the name of the superclass
>> or just forgot it. :-)
AM> Python has multiple inheritance, so there is (in general) no single
AM> 'superclass' that you could use that way.
OK but consider this:
class A:
def foo( self ):
print 'A.foo'
class B:
def foo( self ):
print 'B.foo'
#class C(A,B):
#...
class C_help(A,B):
pass
class C(C_help):
def foo( self ):
C_help.foo( self )
I would like to have same functionality without writing X_help class
whenever i need it.
--
Best regards,
Niki Spahiev
More information about the Python-list
mailing list