How to generate multiple sets of kwargs in Python 3.5+

Generating Multiple sets of kwargs in Python 3.5+

Solution

>>> def process_data(a, b, c, d):
>>>    print(a, b, c, d)

>>> x = {'a': 1, 'b': 2}
>>> y = {'c': 3, 'd': 4}

>>> process_data(**x, **y)
1 2 3 4

>>> process_data(**x, c=23, d=42)
1 2 23 42

More Questions