From: Oti <oh...@ya...> - 2005-03-04 00:12:46
|
[ Alex Greif ] > I have problems to understand why the following does not wirk in > jython: > > >>> import java > >>> class A(java.io.Serializable):pass > ... > >>> class B(java.util.HashMap):pass > ... > >>> class C(A,B):pass > ... > Traceback (innermost last): > File "<console>", line 1, in ? > TypeError: no multiple inheritance for Java classes: > org.python.proxies.__main__$B$1 and org.python.proxies.__main__$A$0 > > > C inherits only from one concrete java class (HashMap). > Any help is appreciated. Alex, two things to mention: HashMap already implements Serializable. And if you want to extend a java class and implement an interface, you can do it like this: >>> from java.util import HashMap >>> from java.lang import Comparable >>> class A(HashMap, Comparable): ... pass ... >>> class B(A): ... pass ... >>> Best wishes, Oti. |