Ejemplo n.º 1
0
// Compare returns the result of comparing "obj" and "obj2".  This is equivalent
// to the Python "cmp(obj, obj2)".
func (obj *Base) Compare(obj2 *Base) (int, error) {
	ret := C.PyObject_Compare(obj.c(), obj2.c())
	return int(ret), exception()
}
Ejemplo n.º 2
0
// int PyObject_Compare(PyObject *o1, PyObject *o2)
// Compare the values of o1 and o2 using a routine provided by o1, if one exists, otherwise with a routine provided by o2. Returns the result of the comparison on success. On error, the value returned is undefined; use PyErr_Occurred() to detect an error. This is equivalent to the Python expression cmp(o1, o2).
func (self *PyObject) Compare(o2 *PyObject) int {
	return int(C.PyObject_Compare(self.ptr, o2.ptr))
}
Ejemplo n.º 3
0
// Compare returns the result of comparing "obj" and "obj2".  This is equivalent
// to the Python "cmp(obj, obj2)".
func (obj *BaseObject) Compare(obj2 Object) (int, error) {
	ret := C.PyObject_Compare(c(obj), c(obj2))
	return int(ret), exception()
}