embed python: how do you call a class's attribute that is located inside another class...

David Ang davidang at info.com.ph
Thu May 29 09:53:53 EDT 2003


Hello,

ie,

class A
    self.list = []
    def somefunc
        b = self.B()
        ...
        list.append(b)

    Class B
         self.someValue = ""


how do you exactly call B's self.someValue in C?

i tried doing this but fail...

PyObject *pObj = PyMapping_GetItemString(pDict, "someInstance");
PyObject_GetAttrString(pObj, "list[0].someValue") 
// returns -1

many thanks.

David




More information about the Python-list mailing list