[PYTHON MATRIX-SIG] C API questions

Konrad Hinsen hinsen@ibs.ibs.fr
Wed, 6 Nov 96 10:38:44 +0100


> My usual solution in this case is to copy data frequently.  I assume that
> you want to modify the array x in-place here?  My own approach in these
> situation has been to change my C API to something like:

Yes, the data does get modified, but even without modification I wouldn't
think of copying, because the arrays can be very large (meaning a few MB,
and there are several of them around).

But I just got another idea: if before returning I set the array's
shape to something corresponding to a zero length array, then
there should be no way to access its memory area, right? Ignoring
of course buggy C extensions, which I don't care about. To be
even more safe, I could change the data pointer to point to some
small statically allocated area. Or am I missing something?

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================