From: Riaan B. <riaan@e.co.za> - 2002-01-31 22:56:43
|
Hi Mike, you are entirely right. Thanks for clearing things up. This will teach me to try and teach you, and to wait at least a day after installing Python 2.2 before commenting on something ;) "Mike C. Fletcher" wrote: > > That particular example still works fine in 2.2 (it's even seen in the > tutorial on type/class unification) ( > http://www.python.org/2.2/descrintro.html#cooperation ). > > >>> class A: > ... def m( self ): pass > ... > >>> class B(A): > ... def m( self ): return A.m( self ) > ... > >>> class C( B ): > ... def m( self ): return A.m( self ) > ... > >>> c = C() > >>> c.m() > >>> import sys > >>> sys.version > '2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)]' > >>> > > It's a fairly core semantic that an instance of a sub-class should > always be considered an instance of the base-class, no matter how far > down the chain it is. When that changes I'll submit a bug report to > Python 2.2, rather than Boa ;) . > > The error comes from the following, I think: > http://www.python.org/2.2/descrintro.html#incompatibilities > > class A: > def foo(self): pass > > class B(A): pass > > class C(A): > def foo(self): > B.foo(self) > > That is, two classes, both of which inherit from A, but _not_ in series > (i.e. both inherit from A, but they don't inherit from each other). The > error now caught is calling _across_ the parallel hierarchy. > > You probably knew that and just mis-typed in the email, but thought I > should make sure :) . > > Enjoy, > Mike > > Riaan Booysen wrote: > > Hi Mike, these are bugs in Boa. > > > > This is what's happening: > > > > class A: > > def m(self): pass > > > > class B(A): > > def m(self): A.m(self) > > > > class C(B): > > def m(self): A.m(self) > > > > c = C() > > c.m() > > > > This snippet use to be work under Python >= 2.1 (although it is usually > > a copy paste error) but doesn't under Python 2.2. > > > > As I've said on the Boa list, I hope to release Boa 0.1.1 soon, as there > > are a few places in the code base this problem occurs. > _______________________________________ > Mike C. Fletcher > http://members.rogers.com/mcfletch/ > > _______________________________________________ > Boa-constructor-users mailing list > Boa...@li... > https://lists.sourceforge.net/lists/listinfo/boa-constructor-users -- Riaan Booysen ___________________________________________________ Boa Constructor - RAD GUI building IDE for wxPython http://boa-constructor.sourceforge.net |