API functions not working as expected
Kirk McDonald
kirklin.mcdonald at gmail.com
Thu Jun 15 19:51:07 EDT 2006
... for reasons that are obvious in retrospect. Specifically, I am
talking about the PyNumber_InPlace* family of functions. For example,
the docs for InPlaceAdd say:
PyObject* PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2)
Return value: New reference.
Returns the result of adding o1 and o2, or NULL on failure. The
operation is done in-place when o1 supports it. This is the equivalent
of the Python statement "o1 += o2".
But, of course, numbers are immutable. None of them support in-place
addition. This is not the same as o1 += o2, as o1 is not actually
changed when using this function.
Am I missing something here? Is there, in fact, no point to these
InPlace* functions?
-Kirk McDonald
More information about the Python-list
mailing list