异步通道和实用程序。
asyncio-channel的Python项目详细描述
用于asyncio
协程之间通信和同步的异步通道。在
fromasyncio_channelimportcreate_channel# Create a new channel.ch=create_channel()# Put an item on the channel; block until the item is accepted.awaitch.put(x)# Take an item from the channel; block until an item is available.x=awaitch.take()# Do something each time an item is put on the channel.asyncforxinch:do_something(x)do_something_else(x)# Iteration stops when the channel is closed and drained.
还包含几个实用程序,用于在通道之间管道项目、混合多个输入通道、按主题路由消息等。在
- 项目
标签: