Mapping Protocol¶
- int
PyMapping_Check(PyObject *o)¶ Return
1if the object provides mapping protocol, and0otherwise. Thisfunction always succeeds.
- Py_ssize_t
PyMapping_Size(PyObject *o)¶ - Py_ssize_t
PyMapping_Length(PyObject *o)¶ Returns the number of keys in objecto on success, and
-1on failure. Forobjects that do not provide mapping protocol, this is equivalent to the Pythonexpressionlen(o).
- int
PyMapping_DelItemString(PyObject *o, const char *key)¶ Remove the mapping for objectkey from the objecto. Return
-1onfailure. This is equivalent to the Python statementdelo[key].
- int
PyMapping_DelItem(PyObject *o,PyObject *key)¶ Remove the mapping for objectkey from the objecto. Return
-1onfailure. This is equivalent to the Python statementdelo[key].
- int
PyMapping_HasKeyString(PyObject *o, const char *key)¶ On success, return
1if the mapping object has the keykey and0otherwise. This is equivalent to the Python expressionkeyino.This function always succeeds.
- int
PyMapping_HasKey(PyObject *o,PyObject *key)¶ Return
1if the mapping object has the keykey and0otherwise. Thisis equivalent to the Python expressionkeyino. This function alwayssucceeds.
- PyObject*
PyMapping_Keys(PyObject *o)¶ - Return value: New reference.
On success, return a list or tuple of the keys in objecto. On failure,returnNULL.
- PyObject*
PyMapping_Values(PyObject *o)¶ - Return value: New reference.
On success, return a list or tuple of the values in objecto. On failure,returnNULL.
- PyObject*
PyMapping_Items(PyObject *o)¶ - Return value: New reference.
On success, return a list or tuple of the items in objecto, where each itemis a tuple containing a key-value pair. On failure, returnNULL.
