Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-11 Thread Scott David Daniels
The Music Guy wrote: ... def main(): ... class MyMixin(object): This is a mistake. If Mixins inherit from CommonBase as well, no order of class definition can catch you out. If it doesn't, you can get yourself in trouble. def method_x(self, a, b, c): super(MyMixin, self).met

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread ryles
On Sep 9, 7:48 pm, The Music Guy wrote: > Btw, Carl, please forgive me if I frustrate you, because I'm trying my > best not to. I'm trying to keep track of what I did and what you did > and what Ryles and Scott did, while at the same time trying to keep a > firm grasp of exactly what it is I'm try

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread Carl Banks
On Sep 9, 4:37 pm, The Music Guy wrote: > On Wed, Sep 9, 2009 at 1:21 PM, Carl Banks wrote: > > On Sep 8, 10:47 pm, The Music Guy wrote: > > What is get_other_base?  Just use a regular super call here, > > get_other_base and hacks like that are what gets you into trouble. > > > You seem to be ove

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread The Music Guy
Btw, Carl, please forgive me if I frustrate you, because I'm trying my best not to. I'm trying to keep track of what I did and what you did and what Ryles and Scott did, while at the same time trying to keep a firm grasp of exactly what it is I'm trying to acheive. Besides that, I'm not a professio

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread The Music Guy
On Wed, Sep 9, 2009 at 1:21 PM, Carl Banks wrote: > On Sep 8, 10:47 pm, The Music Guy wrote: > What is get_other_base?  Just use a regular super call here, > get_other_base and hacks like that are what gets you into trouble. > > You seem to be overthinking this.  You don't need to.  Just use supe

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread Carl Banks
On Sep 8, 10:47 pm, The Music Guy wrote: > I should also mention--and I should have realized this much > sooner--that each of the BaseN classes are themselves each going to > have at least one common base which will define method_x, so each > BaseN will be calling that if it defines its own method

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-09 Thread ryles
On Sep 9, 1:47 am, The Music Guy wrote: > I should also mention--and I should have realized this much > sooner--that each of the BaseN classes are themselves each going to > have at least one common base which will define method_x, so each > BaseN will be calling that if it defines its own method_

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-08 Thread The Music Guy
I should also mention--and I should have realized this much sooner--that each of the BaseN classes are themselves each going to have at least one common base which will define method_x, so each BaseN will be calling that if it defines its own method_x. Again, sorry I didn't mention that sooner. For

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-08 Thread The Music Guy
On Mon, Sep 7, 2009 at 3:30 PM, Carl Banks wrote: > > That's not what you did in your original post, though. > > Mixins should be listed first among bases, which is how you did it in > your original post, and how it had to be in order for it to "just > work" as I claimed. > > class FooX(MyMixin, Ba

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-07 Thread Carl Banks
On Sep 6, 10:48 pm, The Music Guy wrote: > Sorry, that last code had a typo in it: > > #!/usr/bin/python > > def main(): >     foox = FooX() >     fooy = FooY() >     fooz = FooZ() > >     foox.method_x("I", "AM", "X") >     print >     fooy.method_x("ESTOY", "Y", "!") >     print >     fooz.metho

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-06 Thread The Music Guy
Sorry, that last code had a typo in it: #!/usr/bin/python def main(): foox = FooX() fooy = FooY() fooz = FooZ() foox.method_x("I", "AM", "X") print fooy.method_x("ESTOY", "Y", "!") print fooz.method_x(100, 200, 300) class MyMixin(object): def method_x(self,

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-06 Thread The Music Guy
On Sat, Sep 5, 2009 at 8:41 PM, Carl Banks wrote: > Out of curiosity, did you try this and are reporting that it resulted > in an AttributeError, or did you merely deduce that it would raise > AttributeError based on your knowledge of Python's inheritance? > > I ask this rhetorically.  I know that

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-05 Thread Carl Banks
On Sep 4, 3:01 am, The Music Guy wrote: > I have a peculiar problem that involves multiple inheritance and method > calling. > > I have a bunch of classes, one of which is called MyMixin and doesn't > inherit from anything. MyMixin expects that it will be inherited along > with one of several oth

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-05 Thread ryles
On Sep 4, 6:01 am, The Music Guy wrote: > I have a peculiar problem that involves multiple inheritance and method > calling. > > I have a bunch of classes, one of which is called MyMixin and doesn't > inherit from anything. MyMixin expects that it will be inherited along > with one of several oth

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-05 Thread The Music Guy
On Fri, Sep 4, 2009 at 11:23 AM, Scott David Daniels wrote: > The Music Guy wrote: >> >> I have a peculiar problem that involves multiple inheritance and method >> calling. >> >> I have a bunch of classes, one of which is called MyMixin and doesn't >> inherit from anything. MyMixin expects that it

Re: Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-04 Thread Scott David Daniels
The Music Guy wrote: I have a peculiar problem that involves multiple inheritance and method calling. I have a bunch of classes, one of which is called MyMixin and doesn't inherit from anything. MyMixin expects that it will be inherited along with one of several other classes that each define ce

Multiple inheritance - How to call method_x in InheritedBaseB from method_x in InheritedBaseA?

2009-09-04 Thread The Music Guy
I have a peculiar problem that involves multiple inheritance and method calling. I have a bunch of classes, one of which is called MyMixin and doesn't inherit from anything. MyMixin expects that it will be inherited along with one of several other classes that each define certain functionality. It