From: Joshua F. <jo...@jo...> - 2002-03-09 16:31:56
|
Thanks, I see that Jython does in fact allow mult. inh., but not for inheritance from java. I am wondering if there are any points where the JVM limits the full flexible use of Python -- perhaps there are none. Microsoft claims that the .NET Common Language Runtime is designed to be cross-language compatible, but Jython seems to be good evidence that the JVM has that kind of flexibility. At 08:01 AM 3/8/2002 -0700, you wrote: >Joshua Fox wrote: > >>a ban on Python multiple inheritance > > >You can use MI if you don't inherit from multiple >Java classes. All these uses of MI work correctly: > > >>> class A: >... def a(self): print 'a' >... > >>> class B: >... def b(self): print 'b' >... > >>> class C(A,B): >... pass >... > >>> c=C() > >>> c.a() >a > >>> c.b() >b > >>> import java > >>> class D(A,java.lang.Object): >... pass >... > >>> d=D() > >>> d.a() >a > >>> d.toString() >'org.python.proxies.__main__$D$0@23b9c1' > >>> class E(java.lang.Object,java.io.Serializable): >... pass >... > >>> e=E() > >This doesn't: > > >>> class F(java.lang.Number,java.util.Date): >... pass >... >Traceback (innermost last): > File "<console>", line 1, in ? >TypeError: no multiple inheritance for Java classes: java.util.Date and >java.lan >g.Number > |