Using map() function with keyword arguments

Use functools.partial():

from functools import partial

mapfunc = partial(my_function, ip=ip)
map(mapfunc, volume_ids)

partial() creates a new callable, that’ll apply any arguments (including keyword arguments) to the wrapped function in addition to whatever is being passed to that new callable.

Leave a Comment