On Mar 29, 2006, at 1:38 PM, Martin v. Löwis wrote:
> Given that Barry insists so firmly that there is a need, and that
> this need arises from a significant code simplification that can
> be achieved through the API, the natural conclusion is to add
> the API. That, of course, assumes that you believe Barry's testimony.
It doesn't seem to me that there really is a significant code
simplification, looking at the diff between Raymond's code examples.
@@ -7,2 +7 @@
- PyObject *key;
- Py_ssize_t pos = 0;
+ PyObject *it, *key;
@@ -13 +12,5 @@
- while (set_next(so, &pos, &key)) {
+ it = PyObject_GetIter(self);
+ if (it == NULL)
+ return -1;
+
+ while ((key = PyIter_Next(it)) != NULL) {
@@ -14,0 +18 @@
+ Py_DECREF(key);
@@ -16 +20,2 @@
- return -1;
+ Py_DECREF(it);
+ return -1;
@@ -19,0 +25,3 @@
+ Py_DECREF(it);
+ if (PyErr_Occurred())
+ return -1;
James
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com