Esempio n. 1
0
// 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
}
Esempio n. 2
0
// 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
}
Esempio n. 3
0
// 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))
}