super() and automatic method combination

Laszlo Zsolt Nagy gandalf at geochemsource.com
Wed May 18 09:57:20 EDT 2005


>The trick is that C.f only calls A.f, but A.f needs to end up calling B.f 
>when it is used in a C.
>  
>
I believe your response only applies to single inheritance. For classes 
with muliple bases classes, you need to call the base methods one by one.

BTW I prefer to call the base methods in this form:

class AB(A,B):
    def f(self):
       A.f(self)
       B.f(self)

This arises the question: is there a difference between these:

super(A,self).f()  # I do not use to use this....
A.f(self)

-- 
_________________________________________________________________
  Laszlo Nagy		      web: http://designasign.biz
  IT Consultant		      mail: gandalf at geochemsource.com

     		Python forever!





More information about the Python-list mailing list