-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Backport next() #46971
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Backporting 3.0's next() builtin. There's no change w.r.t. __next__/next, that is tracked in bpo-2336. |
ISTM, the only value added by next(g) is that it replaces g.next() with |
IMO having next() in 2.6 helps since if you use it consistently you Also, I don't see how this is different from having e.g. reduce() and |
The problem is with the "if you use it consistently" premise. That |
I think it's important to make this available in 2.6; it will let people |
I thought new code is supposed to use Py_TYPE macro instead of ->ob_type: + "%.200s object is not an iterator", it->ob_type-
Py3k branch has the same issue. |
One more question: What is the rationale for + res = (*it->ob_type->tp_iternext)(it); ? I would think tp_iternext failing to set an exception should not be |
Wrong; the iternext slot is designed to return NULL without setting an |
+1 on this. I have a few nits about the code: Line 1083: "%.200s object is not an iterator", it->ob_type->tp_name); Line 1088: if (res == NULL) { if (res != NULL) ? Line 1089: if (def) {
if (def != NULL) { Line 1093: PyErr_Clear(); |
On Wed, Apr 30, 2008 at 12:41 PM, Guido van Rossum
I did not know that. Thanks for the explanation. In this case, |
On Wed, Apr 30, 2008 at 12:41 PM, Guido van Rossum
This is not what the documentation says: """ It looks like documentation needs to be updated, but wouldn't it be |
Feel free to submit a patch to fix the docs. Changing the API is not an option -- it's been like this since the The requirement that the exception is *optional* is so that if you're Calling PyIter_Next() here instead of inlining it would not be |
Updated and committed as r62599. Also fixed your nits in the original 3k |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: