On 2010-01-29 11:00 AM, Mr.M wrote:
I think this sounds like a stupid question, but I searched the C/Api doc
and google but I wasn't able to find any hint:
how can I retrive PyObject pointer if I only know it's name?
What I'd like to do is something like this:
[code]
PyObject* obj = PyFindWhatImLookingFor("w.z.y.x");
[/code]
Of course if I know that w is a module, z is a class and so on I can
search w dictionary than z members than...
But I wonder if there is a way to retrive without knowing what w.z.y.x
means.
There is probably a clever/careful way to do it, but most systems that do this
just separate the package/module parts from the object parts:
"w:z.y.x"
Import the module part, then getattr() your way down the object part.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
--
http://mail.python.org/mailman/listinfo/python-list