예제 #1
0
파일: object.go 프로젝트: gward/go-python
// 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))
}
예제 #2
0
파일: object.go 프로젝트: MogeiWang/py
// 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)
}
예제 #3
0
파일: base.go 프로젝트: xushiwei/gopy
// 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)
}
예제 #4
0
파일: object.go 프로젝트: MogeiWang/py
// 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)
}
예제 #5
0
파일: base.go 프로젝트: xushiwei/gopy
// 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)
}