[Python-ideas] PEP 525: Asynchronous Generators
Guido van Rossum
guido at python.org
Tue Aug 9 12:08:04 EDT 2016
On Tue, Aug 9, 2016 at 7:13 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> On 9 August 2016 at 13:27, Guido van Rossum <guido at python.org> wrote:
>
>> Just don't oversell run_until_complete() -- some people coming from
>> slightly different event loop paradigms expect to be able to pump for
>> events at any point, possibly causing recursive invocations. That doesn't
>> work here (and it's a feature it doesn't).
>>
>
> Ah, interesting - I'd only ever used it for the "synchronous code that
> just wants this *particular* operation to run asynchronously in the current
> thread" case, which it handles nicely :)
>
It's really best reserved just for the main() function of an app. Anywhere
else, you run the risk that your use of the event loop gets hidden in
layers of other code (example: some logging backend that writes to a
database) and eventually someone will call your function from an async
callback or coroutine.
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160809/d280a5d3/attachment.html>
More information about the Python-ideas
mailing list