خرید بک لینک

Vote count: 0

Suppose I have a function whose the prototype is:

def my_func(fixed_param, *args)

I would like to run this function with multiple arguments (not necessary the same number of arguments for each run) such as:

res = map(partial(my_func, fixed_param=3), [[1, 2, 3], [1, 2, 3, 4]])

where [1, 2, 3] and [1, 2, 3, 4] respectively correspond to the first and second set of parameters for args.

I would rather use map than list comprehension as it is faster.

asked 14 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 6 مرداد 1395 ساعت: 18:12

صفحه بندی