Q: passing function parameter names as strings I'm working with an API that has dozens of parameters in a given function:
api.update_customer(a='', b='', c='', ..., x='', y='', z='')

I'll only need to update one or a few parameters when I call it, for instance:
api.update_customer(email='new.email@example.com')

...but I won't know in advance which object needs updating (maybe email, maybe phone number, etc).
How can I build a wrapper around this call so I can pass in both the parameter name and its new value?
def update_customer_details(key, value):
    api.update_customer(key=value)


A: You don't need to write a wrapper. Just pass a dict using keyword expansion.
params = {'email': 'new.email@example.com'}
api.update_customer(**params)


A: To expand on Daniel Roseman answer for an example on how it gets used:
def test2(x=None):
    print(x)

def test(**kwarg):
    test2(**kwarg)

test(x=5)

output: 5

A: you can  try:
api.update_customer(field='my_field', value='my_value', *args, **kwrgs) 

