Exemplo n.º 1
0
// IsSubclass retuns true if "obj" is a Subclass of "cls", false otherwise.  If
// "cls" is a Tuple, then true is returned if "obj" is a Subclass of any member
// of "cls".  This is equivalent to the Python "issubclass(obj, cls)".
func (obj *Base) IsSubclass(cls *Base) (bool, error) {
	ret := C.PyObject_IsSubclass(obj.c(), cls.c())
	return int2BoolErr(ret)
}
Exemplo n.º 2
0
// int PyObject_IsSubclass(PyObject *derived, PyObject *cls)
// Returns 1 if the class derived is identical to or derived from the class cls, otherwise returns 0. In case of an error, returns -1. If cls is a tuple, the check will be done against every entry in cls. The result will be 1 when at least one of the checks returns 1, otherwise it will be 0. If either derived or cls is not an actual class object (or tuple), this function uses the generic algorithm described above.
//
// New in version 2.1.
//
// Changed in version 2.3: Older versions of Python did not support a tuple as the second argument.
func (self *PyObject) IsSubclass(cls *PyObject) int {
	return int(C.PyObject_IsSubclass(self.ptr, cls.ptr))
}
Exemplo n.º 3
0
// IsSubclass retuns true if "obj" is a Subclass of "cls", false otherwise.  If
// "cls" is a Tuple, then true is returned if "obj" is a Subclass of any member
// of "cls".  This is equivalent to the Python "issubclass(obj, cls)".
func (obj *BaseObject) IsSubclass(cls Object) (bool, error) {
	ret := C.PyObject_IsSubclass(c(obj), c(cls))
	return int2BoolErr(ret)
}