On Fri, Nov 28, 2014 at 8:18 PM, Victor Stinner
<victor.stin...@gmail.com> wrote:
> 2014-11-28 10:12 GMT+01:00 Greg Ewing <greg.ew...@canterbury.ac.nz>:
>> 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
>
> The Trollius coroutine uses "raise Return(value)" which is basically a
> "raise StopIteraton(value)", and this is forbidden by the PEP 479.
> With the PEP 479, the StopIteration is replaced with a RuntimeError.

The question, I guess, is: Why can't it be translated into "return
value"? One answer is: Because that's not legal in Python 2.7. And I
can't respond to that answer, unfortunately. That's the one major
backward compat issue.

(Another answer may be "Because it would require changes to many
intermediate generators, not all of which are under our control". If
that's the issue, then it'll simply be a matter of telling people
"When you upgrade to Python 3.6, you will start to see warnings unless
you make this change".)

ChrisA
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to