Nick Coghlan added the comment:

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 

    def __anext__(self):
            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)


Python tracker <>
Python-bugs-list mailing list

Reply via email to