示例#1
0
文件: object.go 项目: MogeiWang/py
// GetAttr returns the attribute of "obj" with the name "name".  This is
// equivalent to the Python "obj.name".
//
// Return value: New Reference.
func (obj *Base) GetAttr(name *Base) (*Base, error) {
	ret := C.PyObject_GetAttr(obj.c(), name.c())
	return obj2ObjErr(ret)
}
示例#2
0
文件: object.go 项目: gward/go-python
// PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name)
// Return value: New reference.
// Retrieve an attribute named attr_name from object o. Returns the attribute value on success, or NULL on failure. This is the equivalent of the Python expression o.attr_name.
func (self *PyObject) GetAttr(attr_name *PyObject) *PyObject {
	return togo(C.PyObject_GetAttr(self.ptr, attr_name.ptr))
}
示例#3
0
文件: base.go 项目: xushiwei/gopy
// GetAttr returns the attribute of "obj" with the name "name".  This is
// equivalent to the Python "obj.name".
//
// Return value: New Reference.
func (obj *BaseObject) GetAttr(name Object) (Object, error) {
	ret := C.PyObject_GetAttr(c(obj), c(name))
	return obj2ObjErr(ret)
}