A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-November/137251.html below:

[Python-Dev] PEP 479 and asyncio

[Python-Dev] PEP 479 and asyncio [Python-Dev] PEP 479 and asyncioGreg Ewing greg.ewing at canterbury.ac.nz
Fri Nov 28 10:12:05 CET 2014
Guido van Rossum wrote:

> The issue here is that asyncio only interprets StopIteration as 
> returning from the generator (with a possible value), while a Trollius 
> coroutine must use "raise Return(<value>)" to specify a return value; 
> this works as long as Return is a subclass of StopIteration, but PEP 479 
> will break this by replacing the StopIteration with RuntimeError.

I don't understand. If I'm interpreting PEP 479 correctly, in
'x = yield from foo', a StopIteration raised by foo.__next__()
doesn't get turned into a RuntimeError; rather it just stops the
sub-iteration as usual and its value attribute gets assigned to x.

As long as a Trollius coroutine behaves like something implementing
the iterator protocol, it should continue to work fine with
Return as a subclass of StopIteration.

Or is there something non-obvious about Trollius that I'm
missing?

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4