Given a simple class:
class MyClassA():
def __init__(self, param_a, param_b):
self.param_a = param_a
self.param_b = param_b
def my_method(self, param_c):
return some_fun(self.param_a, self.param_b)
Now I want to create an instance of this class with just param_b being set.
Namely something like:
class MyClassB(MyClassA):
def __init__(self, param_a):
super().__init__(param_a, something)
Now I want: my_obj_c = MyClassB(some_val).
The question, is there a way to get my_obj_c in one liner without explicitly building MyClassB?
Motivation
The reason I need this is actually this class is used by a different procedure which supports calling the class with a single input.
What I want is to try it (like grid search) which many different values of param_b. This is why setting a default value won't do it.
What do you think about
this way you can create instance like this:
In the second instance the param_b will be someValue