GNU Info

Info Node: (python2.1-api.info)Mapping Protocol

(python2.1-api.info)Mapping Protocol


Next: Buffer Protocol Prev: Sequence Protocol Up: Abstract Objects Layer
Enter node , (file) or (file)node

Mapping Protocol
================

`int PyMapping_Check(PyObject *o)'
     Return `1' if the object provides mapping protocol, and `0'
     otherwise.  This function always succeeds.

`int PyMapping_Length(PyObject *o)'
     Returns the number of keys in object O on success, and `-1' on
     failure.  For objects that do not provide mapping protocol, this
     is equivalent to the Python expression `len(O)'.

`int PyMapping_DelItemString(PyObject *o, char *key)'
     Remove the mapping for object KEY from the object O.  Return `-1'
     on failure.  This is equivalent to the Python statement `del
     O[KEY]'.

`int PyMapping_DelItem(PyObject *o, PyObject *key)'
     Remove the mapping for object KEY from the object O.  Return `-1'
     on failure.  This is equivalent to the Python statement `del
     O[KEY]'.

`int PyMapping_HasKeyString(PyObject *o, char *key)'
     On success, return `1' if the mapping object has the key KEY and
     `0' otherwise.  This is equivalent to the Python expression
     `O.has_key(KEY)'.  This function always succeeds.

`int PyMapping_HasKey(PyObject *o, PyObject *key)'
     Return `1' if the mapping object has the key KEY and `0'
     otherwise.  This is equivalent to the Python expression
     `O.has_key(KEY)'.  This function always succeeds.

`PyObject* PyMapping_Keys(PyObject *o)'
     On success, return a list of the keys in object O.  On failure,
     return `NULL'. This is equivalent to the Python expression
     `O.keys()'.

`PyObject* PyMapping_Values(PyObject *o)'
     On success, return a list of the values in object O.  On failure,
     return `NULL'. This is equivalent to the Python expression
     `O.values()'.

`PyObject* PyMapping_Items(PyObject *o)'
     On success, return a list of the items in object O, where each
     item is a tuple containing a key-value pair.  On failure, return
     `NULL'. This is equivalent to the Python expression `O.items()'.

`PyObject* PyMapping_GetItemString(PyObject *o, char *key)'
     Return element of O corresponding to the object KEY or `NULL' on
     failure. This is the equivalent of the Python expression `O[KEY]'.

`int PyMapping_SetItemString(PyObject *o, char *key, PyObject *v)'
     Map the object KEY to the value V in object O.  Returns `-1' on
     failure.  This is the equivalent of the Python statement `O[KEY] =
     V'.


automatically generated by info2www version 1.2.2.9