AttributeError: instance has no attribute 'function'
<pre><code>class f:
def f1(self, x):
    return x
def f2(self, x):
    return 2.0*x
def f3(self, x, function=f1):
    return self.function(x)
</code></pre>

<p>then</p>

<pre><code>&gt;&gt;&gt;f0=f()
&gt;&gt;&gt;f0.f3(1)
</code></pre>

<p>the error is:</p>

<pre><code>"AttributeError: f instance has no attribute 'function'"
</code></pre>

<p>How can i fix it if i still wanna f3() to select a function of f1 or f2 in this class?</p>