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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…