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.

Author ncoghlan
Recipients asvetlov, gvanrossum, ncoghlan, scoder, vstinner, yselivanov
Date 2015-05-12.00:03:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1431388984.78.0.444072262315.issue24017@psf.upfronthosting.co.za>
In-reply-to
Content
Latest version looks good to me (aside from a quibble about whether StopAsyncIteration should inherit from BaseException instead of Exception - see my review for details).

Based on Guido's explanation in the review, I also suggested adding the following example method to the PEP as part of the rationale for StopAsyncIteration:

    def __anext__(self):
        try:
            data = await self._get_data()
        except EOFError:
            raise StopAsyncIteration
        return data

The trick is that when __anext__ is itself a coroutine, we really do have 3 exit paths:

* suspension to wait for events (await)
* returning the next value (return)
* terminating iteration (raise StopAsyncIteration)
History
Date User Action Args
2015-05-12 00:03:04ncoghlansetrecipients: + ncoghlan, gvanrossum, scoder, vstinner, asvetlov, yselivanov
2015-05-12 00:03:04ncoghlansetmessageid: <1431388984.78.0.444072262315.issue24017@psf.upfronthosting.co.za>
2015-05-12 00:03:04ncoghlanlinkissue24017 messages
2015-05-12 00:03:04ncoghlancreate