Re: How do I say "two classes up in the inheritance chain" in python?

2009-01-27 Thread Daniel Fetchinson
>> I have two classes that both inherit from two other classes which both >> inherit from a single class. The two children have two almost >> identical methods: >> >> class grandparent( object ): >> def meth( self ): >> # do something >> >> class parent1( grandparent ): >> def meth(

Re: How do I say "two classes up in the inheritance chain" in python?

2009-01-27 Thread Bruno Desthuilliers
Daniel Fetchinson a écrit : I have two classes that both inherit from two other classes which both inherit from a single class. The two children have two almost identical methods: class grandparent( object ): def meth( self ): # do something class parent1( grandparent ): def met

Re: How do I say "two classes up in the inheritance chain" in python?

2009-01-27 Thread Ben Finney
Daniel Fetchinson writes: > The meth methods in child1 and child2 are the same, except that in > the last super call, one is referring to parent1, the other is > referring to parent2. It's important to learn that, in a language with multiple inheritance, “superclass of this instance” is *not* th

Re: How do I say "two classes up in the inheritance chain" in python?

2009-01-27 Thread Duncan Booth
Daniel Fetchinson wrote: > > class child1( parent1 ): > def meth( self ): > # do something c > super( parent1, self ).meth( ) # I want to invoke meth on > grandparent So just call: grandparent.meth(self) If you want to ignore the inheritance hierarchy then

How do I say "two classes up in the inheritance chain" in python?

2009-01-26 Thread Daniel Fetchinson
I have two classes that both inherit from two other classes which both inherit from a single class. The two children have two almost identical methods: class grandparent( object ): def meth( self ): # do something class parent1( grandparent ): def meth( self ): # do someth