消息 [242927]
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) |
|
| 日期 |
用户 |
动作 |
参数 |
| 2015-05-12 00:03:04 | ncoghlan | 修改 | recipients:
+ ncoghlan, gvanrossum, scoder, vstinner, asvetlov, yselivanov |
| 2015-05-12 00:03:04 | ncoghlan | 修改 | messageid: <1431388984.78.0.444072262315.issue24017@psf.upfronthosting.co.za> |
| 2015-05-12 00:03:04 | ncoghlan | 链接 | issue24017 messages |
| 2015-05-12 00:03:04 | ncoghlan | 创建 | |
|