3.71K 浏览
0

写法1:
async with api.register_update_notify(order) as update_chan:
   async for _ in update_chan:
      if not order.is_online:
         break
## 执行…..

写法2:

async with api.register_update_notify(order) as update_chan:
   while not order.is_online:
      await update_chan.recv()
## 执行…..

想问一下 以上两种写法 是不是一样的?

枢之 陈 已回答的问题 2020年1月17日
0

执行过程是一样的,不过第二种写法你没有给那个update_chan里面await出来的东西赋值

枢之 陈 已回答的问题 2020年1月17日
您正在查看1个答案中的1个,单击此处查看所有答案。