コード例 #1
0
ファイル: object.go プロジェクト: MogeiWang/py
// 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()
}
コード例 #2
0
ファイル: object.go プロジェクト: gward/go-python
// 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))
}
コード例 #3
0
ファイル: base.go プロジェクト: xushiwei/gopy
// 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()
}