According to various javadoc and code usage, various methods require the
use of interned strings. I grepped the 2.2.1 release
code base and see various lines like
if (name == "__class__")
But don't see anywhere obvious that "__class__" gets interned (but
presumably it does -- is that implicit in classes in a single jar or
something?).
But, would it make sense to define constants in PyObject like
static final String __class__ = "__class__" /* .intern() ? */;
for all the well-know python attribute names. The warning about
interning strings in the javadoc would still be required, but this would
prevent a certain class of errors in user code, by recommending the use
of PyObject.__class__, PyObject.__name__, ... for these attributes.
Marvin
|