OLD | NEW |
(Empty) | |
| 1 cdef extern from "Python.h": |
| 2 |
| 3 ############################################################################ |
| 4 # 6.4 Mapping Protocol |
| 5 ############################################################################ |
| 6 |
| 7 bint PyMapping_Check(object o) |
| 8 # Return 1 if the object provides mapping protocol, and 0 |
| 9 # otherwise. This function always succeeds. |
| 10 |
| 11 Py_ssize_t PyMapping_Length(object o) except -1 |
| 12 # Returns the number of keys in object o on success, and -1 on |
| 13 # failure. For objects that do not provide mapping protocol, this |
| 14 # is equivalent to the Python expression "len(o)". |
| 15 |
| 16 int PyMapping_DelItemString(object o, char *key) except -1 |
| 17 # Remove the mapping for object key from the object o. Return -1 |
| 18 # on failure. This is equivalent to the Python statement "del |
| 19 # o[key]". |
| 20 |
| 21 int PyMapping_DelItem(object o, object key) except -1 |
| 22 # Remove the mapping for object key from the object o. Return -1 |
| 23 # on failure. This is equivalent to the Python statement "del |
| 24 # o[key]". |
| 25 |
| 26 bint PyMapping_HasKeyString(object o, char *key) |
| 27 # On success, return 1 if the mapping object has the key key and 0 |
| 28 # otherwise. This is equivalent to the Python expression |
| 29 # "o.has_key(key)". This function always succeeds. |
| 30 |
| 31 bint PyMapping_HasKey(object o, object key) |
| 32 # Return 1 if the mapping object has the key key and 0 |
| 33 # otherwise. This is equivalent to the Python expression |
| 34 # "o.has_key(key)". This function always succeeds. |
| 35 |
| 36 object PyMapping_Keys(object o) |
| 37 # Return value: New reference. |
| 38 # On success, return a list of the keys in object o. On failure, |
| 39 # return NULL. This is equivalent to the Python expression |
| 40 # "o.keys()". |
| 41 |
| 42 object PyMapping_Values(object o) |
| 43 # Return value: New reference. |
| 44 # On success, return a list of the values in object o. On failure, |
| 45 # return NULL. This is equivalent to the Python expression |
| 46 # "o.values()". |
| 47 |
| 48 object PyMapping_Items(object o) |
| 49 # Return value: New reference. |
| 50 # On success, return a list of the items in object o, where each |
| 51 # item is a tuple containing a key-value pair. On failure, return |
| 52 # NULL. This is equivalent to the Python expression "o.items()". |
| 53 |
| 54 object PyMapping_GetItemString(object o, char *key) |
| 55 # Return value: New reference. |
| 56 # Return element of o corresponding to the object key or NULL on |
| 57 # failure. This is the equivalent of the Python expression |
| 58 # "o[key]". |
| 59 |
| 60 int PyMapping_SetItemString(object o, char *key, object v) except -1 |
| 61 # Map the object key to the value v in object o. Returns -1 on |
| 62 # failure. This is the equivalent of the Python statement "o[key] |
| 63 # = v". |
| 64 |
OLD | NEW |