Hi community, Do you have any idea on how to make...
# ask-community
a
Hi community, Do you have any idea on how to make a task mapping with two parameters? For instance, parameter1 = [a, b, c] and parameter2 [1,2,3] So how could I make tasks with all the pairs possibilities : (a, 1),(a,2),...? Thanks in advance
j
You could pass all the parameters to a task to generate the combinations, then write a task to splat the arguments into your original function. Something like:
Copy code
@task
def make_parameters(parameter1, parameter2):
    return list(itertools.product(parameter1, parameter2))

@task
def apply_func(args):
    return original_func(*args)

apply_func.map(make_parameters(parameter1, parameter2))
a
Awesome. How do you see the option of using
partial
j
I'm not sure I understand what you mean. Can you clarify?