esoth
08/25/2026, 12:03 AMdef create_text_file(text, target_path):
with open(target_path, 'w') as f:
f.write(text)
USER_DEFINED_COLORS = ['blue', 'purple', 'yellow']
for color in USER_DEFINED_COLORS:
# create a graph node corresponding to this function call:
create_text_file(color, f'{color[0]}.txt')
so that if the user-defined set of colors is ['blue', 'purple', 'yellow'], then I would get a graph containing 3 nodes representing the function calls
create_text_file('blue', 'b.txt')
create_text_file('purple', 'p.txt')
create_text_file('yellow', 'y.txt')
With some other workflow tools, I can do this by programmatically creating a graph node within the for-loop. I'm wondering if/how this is possible with Hamilton, or is it "too declarative" for this purpose? I've read a bit about Parallelizable but I'm not sure if multiple arguments can be Parallelizable or how Hamilton would zip them together. E.g. in the above example, if both the text argument and the target_path argument are Parallelizable, yielding values of ['blue', 'purple', 'yellow'] and ['b.txt', 'p.txt', 'y.txt'] respectively, can Hamilton know to "zip" them together such that 'blue' goes with 'b.txt' and so on? Much appreciate any input on this, thanks!Elijah Ben Izzy
08/29/2026, 3:53 AMElijah Ben Izzy
08/29/2026, 3:54 AMdef option_sets(user_colors: List[str], files: List[str]) -> Parallelizable[Tuple[str, str]]
for item in zip(user_colors, files):
yield itemElijah Ben Izzy
08/29/2026, 3:54 AM