python-3.x - AbstractEventLoop方法create_server在asyncio的事件模块中如何工作

标签 python-3.x python-asyncio

enter image description here

AbstractEventLoop方法create_server在asyncio的事件模块中如何工作?

最佳答案

asyncio 不使用 AbstractEventLoop 而是使用派生类:SelectorEventLoop(以及 Windows 的 ProactorEventLoop)。

您永远不会通过调用事件循环的构造函数来实例化事件循环,而是使用 asyncio.get_event_loop()/asyncio.new_event_loop() 来实例化它。

请查看asyncio/base_events.pyasyncio/selector_events.py例如实际实现。

关于python-3.x - AbstractEventLoop方法create_server在asyncio的事件模块中如何工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50618913/

相关文章:

python - 在 django 测试中导入函数中运行数据库查询是否有限制?

python argparse遇到 '$'后停止解析

2019 年的 Python 2/3 异步

python-3.x - python : How do I mock an async method that gets called multiple times?

Python asyncio 任务的 yield 很差

python - 在 python 中使用 asyncio 运行多个套接字

python - Matplotlib 直方图或 Seaborn 分布图的箱上没有轮廓

python-3.x - 您正在 64 位操作系统(mac)上运行 32 位 Python,并且无法加载 XGBoost 库。可能的原因,Mac

python - 什么决定了调试器的运行时性能

python - 如何在 pycharms 交互式调试器中评估协程