search

Home  >  Q&A  >  body text

python3.x - python yield from 问题

伊谢尔伦伊谢尔伦2770 days ago427

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 15:52:33

    The statements after yield from will be executed immediately.

    This asynchronous means: when coroutine A performs a blocking operation, it temporarily switches to the execution of other coroutines. When the blocking operation of coroutine A is completed, execution will continue from where coroutine A last paused.

    According to the meaning in the picture, sleep is considered a blocking operation, so it will be switched to other coroutines for execution. After 1s, the event loop gets the message that the blocking operation of sleep has been completed, so it continues to execute the operations after sleep in hello().

    reply
    0
  • Cancelreply