➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 Rosuav
收信人 Rosuav, gvanrossum, python-dev, schlamar
日期 2014-11-21.17:44:45
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1416591886.03.0.79898423852.issue22906@psf.upfronthosting.co.za>
In-reply-to
内容
Yep, the question is whether any of the "raise StopIteration" lines are actually non-local flow control. If they're local, then it's easy: mechanical replacement with "return" and it becomes compatible with all versions (unless it has a value attached to it, as "return x" doesn't work in Py2). But if they're non-local, some refactoring will need to be done.

In any case, my line of argument is: A generator function is not an iterator's __next__ method, ergo iterator protocol does not apply. Use of StopIteration is a hack that happens to work because of how generator functions are implemented (a thin wrapper around an iterator), but it's not part of the *concept* of a generator function.
历史
日期 用户 动作 参数
2014-11-21 17:44:46Rosuav修改recipients: + Rosuav, gvanrossum, python-dev, schlamar
2014-11-21 17:44:46Rosuav修改messageid: <1416591886.03.0.79898423852.issue22906@psf.upfronthosting.co.za>
2014-11-21 17:44:46Rosuav链接issue22906 messages
2014-11-21 17:44:45Rosuav创建