string to type object (C)
Miles
semanticist at gmail.com
Tue Aug 5 20:59:03 EDT 2008
On Tue, Aug 5, 2008 at 2:30 AM, castironpi <castironpi at gmail.com> wrote:
> I'm looking for a one-to-one function from strings to the built-in
> data types in C. I will be keeping the string in a file. I need the
> PyTypeObject* back from it. If nothing else I'll just do a bunch of
> strcmp( "tuple" ) { return &PyTuple_Type; } commands, provided
> &PyTuple_Type; will be linking the right address.
Something along the lines of this?
b = PyImport_Import("__builtin__");
return PyObject_GetAttrString(b, typestring);
-Miles
More information about the Python-list
mailing list