I am looking for a way to input named function arguments as one named list instead of specifying them individually when using the function.
Let's say I have this:
import numpy as np
class Something:
__init__(self, one = None, two = None, three = None, **kwargs):
self.one = one
self.two = two
self.three = three
def sum(self):
np.sum(self.one, self.two, self.three)
Right now, I have to do something like this:
Instance = Something(one = 1, two = 2, three = 3)
Instance.sum()
But what I want to do is something like this:
Inputs = {'one' : 1, 'two': 2, 'three': 3, 'four': 4}
Instance = Something(Inputs)
Instance.sum()
Do you have any solution for this?
Something(**Inputs)? And that's a dictionary, not a "named list".defto your contractor.