C API HowTo ? accessing objects described by dotted string from a (PyObject * )

Mike Hoegeman mhoegeman at ixiacom.com
Thu Dec 18 13:23:28 EST 2003


I'm in a situation where 

-- i have a PyObject * that is a instance of an object
-- i need to access a subobject of that (PyObject *) that is 
   described to me as a dotted string, e.g.:


   "subobject1.listsubobject2[-1].subobject3"

In other words, I need to get 

   self.subobject1.listsubobject2[0].subobject3

where 'self' is the (PyObject *) I have in my C Program

do i have to parse the string and do the C API getattr calls myself
or is there some easier way to do it?

Thanks for any suggestions you all may have..

-mike




More information about the Python-list mailing list