[Python-ideas] The async API of the future: yield-from

Nick Coghlan ncoghlan at gmail.com
Sat Oct 13 09:59:53 CEST 2012


On Sat, Oct 13, 2012 at 3:05 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Although... is there a way to non-destructively test whether
> a generator is exhausted? If so, this could easily be provided
> as a scheduler primitive.

Yes. Take a look at inspect.getgeneratorstate in 3.2+ (previously,
implementations weren't *required* to provide that introspection
capability, but now they do in order to support this function in the
inspect module).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list