func (o *object) GetValue(t *Thread, key interface{}) (value interface{}, found bool, err error) { t.execute(func() { var pyKey *C.PyObject if pyKey, err = encode(key); err != nil { return } defer C.DECREF(pyKey) pyValue := C.PyDict_GetItem(o.pyObject, pyKey) if pyValue == nil { return } value, err = decode(pyValue) found = (err == nil) }) return }
// GetItem returns the Object from dictionary d which has the key "key". If // there is no such Object, then nil is returned (without an error). // // Return value: Borrowed Reference. func (d *Dict) GetItem(key Object) (Object, error) { ret := C.PyDict_GetItem(c(d), c(key)) return obj2ObjErr(ret) }
// PyObject* PyDict_GetItem(PyObject *p, PyObject *key) // Return value: Borrowed reference. // Return the object from dictionary p which has a key key. Return NULL if the key key is not present, but without setting an exception. func PyDict_GetItem(self, key *PyObject) *PyObject { return togo(C.PyDict_GetItem(topy(self), topy(key))) }
// GetItem returns the Object from dictionary d which has the key "key". If // there is no such Object, then nil is returned (without an error). // // Return value: Borrowed Reference. func (d *Dict) GetItem(key *Base) *Base { ret := C.PyDict_GetItem(d.c(), key.c()) return newObject(ret) }