[Numpy-discussion] performing operations in-place in numpy

Citi, Luca lciti@essex.ac...
Thu Jul 9 04:03:47 CDT 2009


Hello Pauli,
excuse me if I insist, PyArray_Conjugate is not the problem.
If when using the numpy API, it is accepted something like:
 ob1 = PyArray_CreateSomehowAnArray(....);
 obj2 = PyArray_DoSomethingWithArray(obj1,...);
 obj3 = PyArray_DoSomethingElseWithArray(obj1,...);
 Py_DECREF(obj1);
then there is no way my patch is guaranteed to not break things.

What happens with conjugate can happen with sin, round, sum, prod, ...
The problem is that the philosophy of the patch is:
"If I (function) have been called with an input with ref_count=1,
that input is mine and I can do whatever I want with it. If you (caller)
need it for later be sure you let me know by incrementing its ref_count."

>From what I understand, this works fine from within numpy, by
changing a few operations (like divmod and variance) but could
break libraries using the numpy C API.

I hope someone can find a way to have the cake and eat it too.

Best,
Luca


More information about the NumPy-Discussion mailing list