[Python-Dev] PEP 550 v4

Guido van Rossum guido at python.org
Wed Sep 6 13:16:35 EDT 2017


On Wed, Sep 6, 2017 at 8:07 AM, Koos Zevenhoven <k7hoven at gmail.com> wrote:

> I think yield from should have the same semantics as iterating over the
> generator with next/send, and PEP 555 has no issues with this.
>

I think the onus is on you and Greg to show a realistic example that shows
why this is necessary.

So far all the argumentation about this has been of the form "if you have
code that currently does this (example using foo) and you refactor it in
using yield from (example using bar), and if you were relying on context
propagation back out of calls, then it should still propagate out."

This feels like a very abstract argument. I have a feeling that context
state propagating out of a call is used relatively rarely -- it  must work
for cases where you refactor something that changes context inline into a
utility function (e.g. decimal.setcontext()), but I just can't think of a
realistic example where coroutines (either of the yield-from variety or of
the async/def form) would be used for such a utility function. A utility
function that sets context state but also makes a network call just sounds
like asking for trouble!

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170906/2ea92497/attachment.html>


More information about the Python-Dev mailing list