From: Samuele P. <pe...@in...> - 2002-02-26 00:27:50
|
Maybe you should consider what is really happening and consider just to change your tests: >>> from java import util,lang >>> import Cont >>> c=Cont() >>> c.set("a") >>> c.get() 'a' >>> c.get().__class__ <jclass org.python.core.PyString at 387569> >>> c.check() a of java.lang.String >>> c.set(lang.String("a")) >>> c.get() 'a' >>> c.get().__class__ <jclass org.python.core.PyString at 387569> >>> c.check() a of java.lang.String [this behaviour is very unlikey to change] where Cont is: public class Cont { private Object obj; public void set(Object obj) { this.obj = obj; } public Object get() { return obj; } public void check() { System.out.println(obj + " of " + obj.getClass().getName()); } } So yes a java.lang.String becomes a PyString but also a PyString becomes a java.lang.String when Object is expected. regards, Samuele Pedroni. |