Pupeno wrote:
> I want to jump over a method in the class hierarchy, that is:  If I have
> class A(object), clas B(A), class C(B) and in C, I want a method to do
> exactly what A does but not what B does in its reimplementation, would it
> be correct to do: super(A, super(B, self)).method() in C ?

You can use __bases__ to climb the class hierarchy:


>>> class A(object):
        def f(self):
                print 1
>>> class B(A):
        def f(self):
                print 2
>>> class C(B):
        def f(self):
                print 3
        def g(self):
                C.__bases__[0].__bases__[0].f(self)     # go up two levels
>>> c = C()
>>> c.f()
3
>>> c.g()
1



Raymond

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

Reply via email to