[Python-Dev] API design: where to add async variants of existing stdlib APIs?

Yury Selivanov yselivanov.ml at gmail.com
Wed Mar 1 10:47:55 EST 2017



On 2017-03-01 2:16 AM, Nathaniel Smith wrote:
> On Tue, Feb 28, 2017 at 9:42 PM, Nick Coghlan<ncoghlan at gmail.com>  wrote:
>> Short version:
>>
>> - there are some reasonable requests for async variants of contextlib APIs
>> for 3.7
>> - prompted by Raymond, I'm thinking it actually makes more sense to add
>> these in a new `asyncio.contextlib` module than it does to add them directly
>> to the existing module
>> - would anyone object strongly to my asking authors of the affected PRs to
>> take their changes in that direction?
> IMHO this is a good idea*iff*  the new APIs really are bound to
> asyncio, rather than being generic across all uses of async/await.

I agree.  There is no need to make asynccontextmanager and
AsyncExitStack dependent on asyncio or specific to asyncio.

They should both stay framework agnostic (use only protocols
defined by PEP 492 and PEP 525) and both shouldn't be put
into asyncio package.

Yury


More information about the Python-Dev mailing list