示例#1
0
文件: object.go 项目: MogeiWang/py
// IsTrue returns true if the value of obj is considered to be True.  This is
// equivalent to "if obj:" in Python.
func (obj *Base) IsTrue() bool {
	ret := C.PyObject_IsTrue(obj.c())
	if ret < 0 {
		panic(exception())
	}
	return ret != 0
}
示例#2
0
文件: abstract.go 项目: gbbr/textmate
// IsTrue returns true if the value of obj is considered to be True.  This is
// equivalent to "if obj:" in Python.
func (obj *AbstractObject) IsTrue() bool {
	ret := C.PyObject_IsTrue(c(obj))
	if ret < 0 {
		panic(exception())
	}
	return ret != 0
}
示例#3
0
文件: object.go 项目: gward/go-python
// int PyObject_IsTrue(PyObject *o)
// Returns 1 if the object o is considered to be true, and 0 otherwise. This is equivalent to the Python expression not not o. On failure, return -1.
func (self *PyObject) IsTrue() bool {
	return int2bool(C.PyObject_IsTrue(topy(self)))
}