Marwan Sarieddine
08/19/2021, 1:22 PMMarwan Sarieddine
08/19/2021, 1:25 PMIn [52]: @task(nout=2)
...: def return_two_items(x):
...: return x + 1, x + 2
In [53]: with Flow("test") as flow:
...: left_item, right_item = return_two_items(5)
# the below is no longer correct
In [54]: with Flow("test") as flow:
...: left_item, right_item = return_two_items(mapped([1, 2, 3, 4]))
# one has to do this and then unzip the reduced list of tuples to a tuple of lists
In [55]: with Flow("test") as flow:
...: out = return_two_items([1, 2, 3, 4])
In [56]: flow.run().result[out].result
Out[56]: [(2, 3), (3, 4), (4, 5), (5, 6)]
Is there a way to return a tuple of two lists instead ?
left_item = [2, 3, 4, 5]
right_item = [3, 4, 5, 6]
Kevin Kho
Tuple
so the map will generate List[Tuple]
. while the format you want is Tuple[List]
so the only way is to shape this with an intermediate task.Marwan Sarieddine
08/19/2021, 1:28 PMKevin Kho