Replacing base class
Scott David Daniels
Scott.Daniels at Acm.Org
Wed Mar 3 10:56:48 EST 2004
Alexey Klimkin wrote:
> Hello!
>
> Is it possible in python to replace base class with another one?
I am not certain what you are asking here. If you use new-style
classes, and I'm correct about what you want, try:
> class A:
-> class A(object):
> def f(self):
> print 'A'
> class B(A):
> def f(self):
> A.f(self)
-> super(B, self).f() # or super(B).f(self) if you prefer
> print 'B'
> class C:
-> class C(object):
> def f(self):
> print 'C'
> ... Any clues?
Hope this is a clue.
--
-Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list