Beispiel #1
0
// int PyDict_Contains(PyObject *p, PyObject *key)
// Determine if dictionary p contains key. If an item in p is matches key, return 1, otherwise return 0. On error, return -1. This is equivalent to the Python expression key in p.
//
// New in version 2.4.
func PyDict_Contains(self, key *PyObject) (bool, error) {
	err := C.PyDict_Contains(topy(self), topy(key))
	if err != -1 {
		return int2bool(err), nil
	}
	return false, int2err(err)
}
Beispiel #2
0
// Contains Returns true if the dictionary contains the given key.  This is
// equivalent to the Python expression "key in d".
func (d *Dict) Contains(key Object) (bool, error) {
	ret := C.PyDict_Contains(c(d), c(key))
	return int2BoolErr(ret)
}
Beispiel #3
0
// Contains Returns true if the dictionary contains the given key.  This is
// equivalent to the Python expression "key in d".
func (d *Dict) Contains(key *Base) (bool, error) {
	ret := C.PyDict_Contains(d.c(), key.c())
	return int2BoolErr(ret)
}