super question

Harry Pehkonen harry.pehkonen at hotpop.com
Mon Sep 1 14:30:50 EDT 2003


Sorry -- Google is not letting me reply to the correct posting . . .

Aahz wrote:
> > but why not just do:
> >
> >    class C(B):
> >        def meth(self, arg):
> >            B.meth(self, arg)
> >
> >Is there any difference?
> >Any advantage either way?

> The advantage comes when you rename B or when you have multiple base
> classes for C.

Like this?:

class C(A, B):
    def __init__(self):
        for parent in C.__bases__:
            parent.__init__(self)

I don't think there is one definitive answer to the question of how to do this.

Harry.




More information about the Python-list mailing list