[Async-sig] Some thoughts on asynchronous API design in a post-async/await world

Glyph Lefkowitz glyph at twistedmatrix.com
Mon Nov 7 19:18:19 EST 2016


> On Nov 7, 2016, at 11:58 AM, Guido van Rossum <guido at python.org> wrote:
> 
> I would caution against rushing into anything rash here. Nathaniel's post will stand as one of the most influential posts (about async I/O in Python) of this generation, and curio is a beacon of clarity compared to asyncio. However, asyncio has a much bigger responsibility at this point, as it's in the stdlib, and it must continue to support its existing APIs, on all supported platforms, whether we like them or not.

My smiley may have been insufficiently forceful. I was not intending to seriously suggest a departure from the current API.  A 3.7/3.8 refinement into preferring a 'current_event_loop' coroutine might be a nice future direction but it is not something that should happen lightly.

> I would love to see a design for a new API that focuses more on coroutines. But it should be a new PEP aimed at Python 3.7 or 3.8.
> 
> I am tempted to start defending asyncio, but I'll resist, because nothing good can come from that.

TBH I think that this discussion stems from a strength of asyncio's design, not a weakness.  As David did, let me underscore Brett's comment: the fact that asyncio has multiple, separable layers which each interact via well-defined interfaces has allowed for a tremendous amount of experimentation and refinement.  Most languages with async features are locked into a particular substrate, and languages without async features end up being an uncoordinated mess of incompatible APIs.  I feel like we're really getting the best of both worlds: language-level support with interoperability and ecosystem considerations baked in right from the start.

The potential for growth and improvement necessarily comes along with disagreement and criticism but it seems like overall this is a very healthy development.

Right now we're talking about this at the async event layer, but previous work at the loop layer (uvloop) also points in exciting future directions for community improvements that maintain interoperability across the whole ecosystem.  All the integration points exposed in asyncio's design already seem to be benefiting from community-wide scrutiny and tinkering.

-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/async-sig/attachments/20161107/699a425a/attachment-0001.html>


More information about the Async-sig mailing list