擅长:python、mysql、java
<p>你是在正确的轨道上,你只需要删除这些括号:</p>
<pre><code>def mainFunction (x, y, helperFunction):
if helperFunction == compareValues1(): <-- this actually CALLS the function!
do stuff
elif helperFunction == compareValues2():
do other stuff
</code></pre>
<p>相反,你会想要</p>
<pre><code>def mainFunction (x, y, helperFunction):
if helperFunction is compareValues1:
do stuff
elif helperFunction is compareValues2:
do other stuff
</code></pre>