GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.python.org — Iterator Protocol — Python v3.2.6 documentation NavigationIterator Protocol¶There are only a couple of functions specifically for working with iterators.
To write a loop which iterates over an iterator, the C code should look something like this: PyObject *iterator = PyObject_GetIter(obj); PyObject *item; if (iterator == NULL) { /* propagate error */ } while (item = PyIter_Next(iterator)) { /* do something with item */ ... /* release reference when done */ Py_DECREF(item); } Py_DECREF(iterator); if (PyErr_Occurred()) { /* propagate error */ } else { /* continue doing useful work */ } Previous topicNext topicThis PageQuick searchEnter search terms or a module, class or function name. Navigation
© Copyright 1990-2014, Python Software Foundation.
The Python Software Foundation is a non-profit corporation. Please donate. Last updated on Oct 12, 2014. Found a bug? Created using Sphinx 1.0.7. |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |