异步事件循环是否仅运行任务?

I’m in the early stages of learning about the asyncio library. I'm starting off with coroutines and tasks, and reading through the hello world examples in the docs.

基于有关协程的部分,似乎有两种主要方法来运行协程对象:

  • Using await on a coroutine
  • Running coroutines as asyncio Tasks

According to the Task docs:

任务用于在事件循环中运行协程。

要清楚一点,这是否意味着除非将事件包装到任务中,否则事件循环不会运行协程对象?在这种情况下,这些协程对象是否只是在不与事件循环交互的情况下同步运行?

评论