HOWTO: use multiple args to map function where one argument is fixed in python

less than 1 minute read

import functools

def function(x, y):
return x + y

arg_list = [1,2,3,4]

# we fix y=10
map(functools.partial(function, y=10), arg_list)

# [11, 12, 13, 14]

Tags:

Categories: ,

Updated:

Leave a Comment