Python -Passing a class method as the default value of an argument to another class initialization
<p>Modifying the original question to prevent confusions. I have 2 classes defined in 2 different modules:</p>

<pre><code>class Heuristic:
    def process(self,data,x,y):
        processed_data = (data + x) /y 
        return processed_data

class GTS(Abstract_Strat):
    def __init__(self, data, method= Heuristic().process(),*args):
        self.data= data
        self.method = method
        self.func_args = args
</code></pre>

<p>So in the class GTS, in the initialization function, I am trying to pass a method that belongs to class heuristic which is in another module. On trying this, I get the following error:</p>

<pre><code>TypeError: process() takes exactly 3 arguments (1 given)
</code></pre>

<p>I searched stackoverflow and found similar questions where the <code>Typerror</code> referred to the <code>_init_</code> method. But in this case, the error is for a function passed in as argument to the <code>_init_</code> method. So the question is- What is the right way to pass a method of one class as a default argument value to to intializer of another class?</p>

<p>I resolved the issue mentioned in the modified question above by changing <code>Heuristic().process()</code> to <code>Heuristic().process</code> when passing it as the default value of the function parameter. </p>

<p>Would also like to thank Andrew for his comment on the original version of the question.</p>

python class methods parameter-passing typeerror