From: Samuele P. <sam...@gm...> - 2018-12-15 09:13:31
|
On Wed, Dec 12, 2018 at 10:35 AM Jeff Allen <ja...@fa...> wrote: > We're discussing this in a couple of places already, but I wanted to ask > here in case there are old hands subscribed who can shed any light. > > http://bugs.jython.org/issue2719 > > https://github.com/jythontools/jython/pull/126 > > PyObject.java contains some comments I've never understood and have had > difficulty following > ( > https://hg.python.org/jython/file/tip/src/org/python/core/PyObject.java#l218). > > It seems advice only relevant to those who extend PyObject, which is > mostly us. And we certainly don't follow it in PyObjectDerived which > contains the mechanism by which Python authors override __str__ and > where toString delegates to __repr__. > > for what is worth that comment seems to be from before new-style classes support, when indeed extending PyObject was easy/natural and was done also outside of the Jython code base itself often, and the code was following Java patterns more than the slightly quirky patterns needed to implement new-style semantics, so telling people implement toString and the runtime will do the rest made sense. |