How to get the python object from a variable name ?

Moshe Zadka moshez at math.huji.ac.il
Sat Apr 29 16:53:04 CEST 2000


On Sat, 29 Apr 2000, Andreas Jung wrote:

> Inside a C program I need to get a pointer to the python object
> for a object or variable by its variable name in the current
> namespace of the interpreter. What I want to do ? My programs
> gets names of variables and I need to get the str() representation
> for given variable/object names as a C (char *). Maybe a stupid
> question but I've no idea :)

Try passing the name of the variable to Py_Eval*() functions.

probably-some-nicer-solution-exists-ly y'rs, Z.
--
Moshe Zadka <mzadka at geocities.com>. 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com





More information about the Python-list mailing list