コード例 #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)
}