Python 元组和元组之间的差异

Python 元组和元组之间的差异,python,pygears,Python,Pygears,PyGears python框架中的元组和元组有什么区别? tuple是Python语法,而tuple是PyGears语法。当您只想从gear发送一个接口时,您必须使用Tuple,而在多个接口中发送数据时,您使用Tuple 代码示例: @gear async def python_gear() -> (Uint[8], Uint[8]): yield (1, 2) @gear async def pygears_gear() -> Tuple[Uint[8], Uint[8

PyGears python框架中的元组和元组有什么区别?
tuple是Python语法,而tuple是PyGears语法。当您只想从gear发送一个接口时,您必须使用Tuple,而在多个接口中发送数据时,您使用Tuple

代码示例:

@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()
齿轮箱代表: