[PYTHON MATRIX-SIG] getting ArrayObjects pointer
Konrad Hinsen
hinsen@ibs.ibs.fr
Thu, 24 Apr 1997 10:16:11 +0200
> In an external C function, I am trying to get the pointer to an
> ArrayObject that was created with PyObject_NEW. If I pass the name
> of the ArrayObject how can I find the objects pointer?
That depends on where the name was defined. It could be in a module,
as a local variable in a function, or as an object attribute.
The most general solution, given the name and the namespace it is in,
is to call an expression evaluation from C.
> Also, Is there any way to get a list of all objects that have been
> created during a Python session, via a C code?
I doubt it, and it would probably not be very useful. Such a list
would include all functions and classes imported from various modules,
including the standard library! You can however easily get all objects
in a given namespace, via its dictionary.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale | Fax: +33-4.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
_______________