Classes: nested functions vs. private methodes

Tim Roberts timr at probo.com
Fri May 7 01:24:28 EDT 2010


Richard Lamboj <richard.lamboj at bilcom.at> wrote:
>
>Thank you for the nice sample, but what is with multiple inheritance in your 
>sample? I mean the super call. Why not _MyClass.blah(self, arg).

Because then I have to remember to change the name if I should happen to
change the base class, or copy this code into another class.

>What is when 
>i have more then one Class from which i inherite and in both are a methode 
>called "blah", but i just want to call one of them and not both, becouse they 
>do different things?

Then you'd need use the full class name, of course.  The search order is
well-defined, so super() is still meaningful.  However, in that case, you
are rapidly getting into a design that is too complicated to understand at
a glance.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list