Example #1
0
// int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v)
// Set the value of the attribute named attr_name, for object o, to the value v. Returns -1 on failure. This is the equivalent of the Python statement o.attr_name = v.
func (self *PyObject) SetAttr(attr_name, v *PyObject) int {
	return int(C.PyObject_SetAttr(self.ptr, attr_name.ptr, v.ptr))
}
Example #2
0
// DelAttr deletes the attribute with the name "name" from "obj".  This is
// equivalent to the Python "del obj.name".
func (obj *Base) DelAttr(name *Base) error {
	ret := C.PyObject_SetAttr(obj.c(), name.c(), nil)
	return int2Err(ret)
}
Example #3
0
// DelAttr deletes the attribute with the name "name" from "obj".  This is
// equivalent to the Python "del obj.name".
func (obj *BaseObject) DelAttr(name Object) error {
	ret := C.PyObject_SetAttr(c(obj), c(name), nil)
	return int2Err(ret)
}
Example #4
0
// SetAttr sets the attribute of "obj" with the name "name" to "value".  This is
// equivalent to the Python "obj.name = value".
func (obj *Base) SetAttr(name, value *Base) error {
	ret := C.PyObject_SetAttr(obj.c(), name.c(), value.c())
	return int2Err(ret)
}
Example #5
0
// SetAttr sets the attribute of "obj" with the name "name" to "value".  This is
// equivalent to the Python "obj.name = value".
func (obj *BaseObject) SetAttr(name, value Object) error {
	ret := C.PyObject_SetAttr(c(obj), c(name), c(value))
	return int2Err(ret)
}