Python 内置 AsyncIO 实现?

Python built-in AsyncIO implementations?

我已经开始了解 AsyncIO,它基本上是 "pauses" 一个函数,当它需要执行非阻塞操作(例如发出 Web 请求或打开文件)时转到下一个函数(还有其他函数吗? ?)

但是,异步网络请求或异步文件打开的内置实现在哪里?没有这些,AsyncIO 不就是一个概念吗?

我只找到了实现它们的外部库。

或者这是预期的情况?如果是这样,我应该如何实现自己的异步 request/file 库?

Python支持aysnc/await在事件循环中自动调度。

aiofiles 是一个 Apache2 许可库,用 Python 编写,用于在异步应用程序中处理本地磁盘文件。

https://github.com/Tinche/aiofiles

对于异步网络请求

https://aiohttp.readthedocs.io/en/stable/

更多异步实现,查看

https://github.com/python/asyncio/wiki/ThirdParty

But then, where are the built-in implementations of an async web request or an async file opening?

asyncio 的目标是为构建异步库和框架提供基础设施。与 Python 捆绑的 asyncio 模块支持 client and server connections, subprocesses, synchronization tools (including queues), execution of blocking code using threading and multiprocessing, as well as communication between blocking code and an event loop running in a different thread.

中的套接字

以此工具集为基础,第三方提供了异步的开源库http, file and console IO, websockets, discord, and many more