示例#1
0
文件: object.go 项目: MogeiWang/py
// HasAttr returns true if "obj" has the attribute "name".  This is equivalent
// to the Python "hasattr(obj, name)".
func (obj *Base) HasAttr(name *Base) bool {
	ret := C.PyObject_HasAttr(obj.c(), name.c())
	if ret == 1 {
		return true
	}
	return false
}
示例#2
0
文件: base.go 项目: xushiwei/gopy
// HasAttr returns true if "obj" has the attribute "name".  This is equivalent
// to the Python "hasattr(obj, name)".
func (obj *BaseObject) HasAttr(name Object) bool {
	ret := C.PyObject_HasAttr(c(obj), c(name))
	if ret == 1 {
		return true
	}
	return false
}
示例#3
0
文件: object.go 项目: gward/go-python
// int PyObject_HasAttr(PyObject *o, PyObject *attr_name)
// Returns 1 if o has the attribute attr_name, and 0 otherwise. This is equivalent to the Python expression hasattr(o, attr_name). This function always succeeds.
func (self *PyObject) HasAttr(attr_name *PyObject) int {
	return int(C.PyObject_HasAttr(self.ptr, attr_name.ptr))
}