PyTypeObject* XXX(PyObject*)

Helmut Zeisel helmut.zeisel at aon.at
Tue Mar 5 04:04:40 EST 2002


I want to use Python from C++.

I get some Python Object using 

PyObject* po = PyRun_String(...);

Depending on the type of the result po,
I want to do different actions with po,
say

typedef (void)(*ActionType)(PyObject*);

and I have an 

std::map<PyTypeObject*,ActionType> actionMap;

which I want to use in the following way:

PyTypeObject* t = XXX(po);
ActionType action = actionMap[t];
if(action!=0)
{
  (*action)();
}

What should be XXX, i.e., what is the name of the function
to get the TypeObject of a Python Object?
If there is no such function XXX, what should be the Key Type of my std::map?

Helmut



More information about the Python-list mailing list