March 2003
Intermediate to advanced
656 pages
39h 30m
English
PyDict_Next
int PyDict_Next(PyObject*x,int*pos,PyObject**k,PyObject**v)
Iterates over items in dictionary x. You
must initialize *
pos to
0 at the start of the iteration:
PyDict_Next uses and updates
*
pos to keep track of
its place. For each successful iteration step, returns
1; when there are no more items, returns
0. Updates
*
k and
*
v to point to the next
key and value respectively (borrowed references) at each step that
returns 1. You can pass either
k or v as
NULL if you are not interested in the key or
value. During an iteration, you must not change in any way the set of
x’s keys, but you can
change x’s values as long
as the set of keys remains identical.