Hello, On Mon, 27 Nov 2017 15:33:51 +1000 Caleb Hattingh <caleb.hatti...@gmail.com> wrote:
[] > The PEP only says that __await__ must return an iterator, but it > turns out that it's also required that that iterator > should not return any intermediate values. This requirement is only > enforced in the event loop, not > in the `await` call itself. I was surprised by that: [] > So we drive the coroutine manually using send(), and we see that > intermediate calls return the illegally-yielded values. I broke the You apparently mix up the language and a particular asynchronous scheduling library (even if that library ships with the language). There're gazillion of async scheduling libraries for Python, and at least some of them welcome use of "yield" in coroutines (even if old-style). Moreover, you can always use yield in your own generators, over which you iterate yourself, all running in the coroutine async scheduler. When you do this, you will need to check type of values you get from iteration - if those are "yours", you consume them, if they're not yours, you re-yield them for higher levels to consume (ultimately, for the scheduler itself). -- Best regards, Paul mailto:pmis...@gmail.com _______________________________________________ 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