Folks,

All of PyInteger's operations (div, mult, etc.) access the actual integer value of the PyInteger via its getValue() method. That makes it easy for me to wrap a Java integer variable and expose it to the interpreter as a built-in name, as I do in my processing.py project. For example

class SomeClass {
    private int myInt = 12;
    PyObject wrappedInt = new PyInteger(0) {
        public int getValue() { return myInt; }
    };
    // now you can
    // ((PyStringMap) interp.getSystemState().getBuiltins()).__setitem__("pythonName", wrappedInt)
    // and within your script
    // print "the answer is %d" % (pythonName + 12)
}

But PyLong, PyBoolean, and PyFloat do not. Instead, they refer to a private "value" member directly. Is there a tactical reason for this? Did someone start to apply the PyInteger pattern, but then get bogged down? Did someone mean to change PyInteger to be like the others?

Kind regards,
--
Jonathan Feinberg  jdf@pobox.com  http://MrFeinberg.com/