From: Anthony E. <ae...@si...> - 2002-03-26 18:23:08
|
Currently, in Jython, using any arbitrary Java object aside from a java.lang.String, the following fails: print "text" + obj With the message: TypeError: __add__ nor __radd__ defined for these operands But the following works: print "test", obj Would the Jython implementers consider modifying the PyJavaInstance class with something similar to: public PyObject __add__(PyObject object) { return __str__ + object.__str__(); } So that the + notation as used in Java works properly? I am not sure if the code I provided above is correct as I am not intimately familiar with the Jython source. I am also not sure if this has been discussed before: the mailing list archives provided at the Jython.org site do not have search facilities (AFAICT) and I was unable to find anything about it in my mail application (back to 7/21/2001), so I apologize ahead of time if it has. Sincerely, Anthony Eden |