Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Scott David Daniels
Here are some tweaks on both bits of code: Paul McGuire wrote: On May 25, 8:37 am, Michael Hines <[EMAIL PROTECTED]> wrote: ... m = False for b in bases : if hasattr(b, '__mro__'): for bb in b.__mro__ : if bb == MetaHocObject.ho : if m == True:

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Gabriel Genellina
En Sun, 25 May 2008 13:32:39 -0300, Paul McGuire <[EMAIL PROTECTED]> escribió: > Here's a more general version of your testing code, to detect *any* > diamond multiple inheritance (using your sample classes). > > for cls in (A,B,C,D): > seen = set() > try: > bases = cls.__bases__ >

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Arnaud Delobelle
Sorry I lost the original post. Paul McGuire <[EMAIL PROTECTED]> writes: > On May 25, 8:37 am, Michael Hines <[EMAIL PROTECTED]> wrote: >> Thanks very much, Arnaud. That is exactly the hint I needed. Since it is >> not multiple inheritance per se I prohibit but only multiple inheritance >> invol

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Paul McGuire
On May 25, 8:37 am, Michael Hines <[EMAIL PROTECTED]> wrote: > Thanks very much, Arnaud. That is exactly the hint I needed. Since it is > not multiple inheritance per se I prohibit but only multiple inheritance > involving more than one HocObject class, I replaced your len(bases) > 1 > test with >

Re: raising an exception when multiple inheritance involves same baseThank

2008-05-25 Thread Michael Hines
Thanks very much, Arnaud. That is exactly the hint I needed. Since it is not multiple inheritance per se I prohibit but only multiple inheritance involving more than one HocObject class, I replaced your len(bases) > 1 test with m = False for b in bases : if hasattr(b, '__mro__'):