Vadim Ogranovich
09/24/2024, 3:29 AMdef y(x: str) -> str:
...
It defines a transform from the input node x to the output node y. Now I want to apply the transform to a Iterable of strings xs: Iterable[str]. What are my options?
One approach is to build a driver and simply loop over xs in an external piece of code and execute the driver on each item. This has a drawback that the input xs and the output ys are not parts of the dag.
Another approach is to pass iterators to the nodes
def y(x: Iterable[str]) -> Iterator[str]:
...
but this fuses iteration with the transform logic and is generally not a good practice. That is I want to be able to code up and debug a transform and then map it onto a sequence.
Any other options?Elijah Ben Izzy
09/24/2024, 3:33 AM