Skip to Content
Python in a Nutshell
book

Python in a Nutshell

by Alex Martelli
March 2003
Intermediate to advanced
656 pages
39h 30m
English
O'Reilly Media, Inc.
Content preview from Python in a Nutshell

Name

PyDict_Next

Synopsis

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python in a Nutshell, 3rd Edition

Python in a Nutshell, 3rd Edition

Alex Martelli, Anna Ravenscroft, Steve Holden
Python in a Nutshell, 4th Edition

Python in a Nutshell, 4th Edition

Alex Martelli, Anna Martelli Ravenscroft, Steve Holden, Paul McGuire
Data Wrangling with Python

Data Wrangling with Python

Jacqueline Kazil, Katharine Jarmul

Publisher Resources

ISBN: 0596001886Supplemental ContentCatalog PageErrata