PyGears 元组和元组之间的区别

PyGears difference between tuple and Tuple

PyGears python框架中元组和元组有什么区别? pygears.org 什么都没提到。

tuple 是 Python 语法,而 Tuple 是 PyGears 语法。当你只想从你的设备发送一个接口时你必须使用元组,而在你使用元组的许多接口中发送你的数据。

代码示例:

@gear
async def python_gear() -> (Uint[8], Uint[8]):
    yield (1, 2)

@gear
async def pygears_gear() -> Tuple[Uint[8], Uint[8]]:
    yield Tuple[1, 1]


pythons_res = []
pygears_res = []
@gear
def consumer():
    pythons = python_gear()
    pygears = pygears_gear()
    collect(ccat(*pythons), result=pythons_res)
    collect(pygears, result=pygears_res)


consumer()
sim()

变速箱表示: