Need to reference a local variable before assigning
<p>I'm currently working on a permutation algorithm that will be used for a traveling sales person kind of problem. I have a method to calculate the cost of the cycle that will call a method (currentBest) to see if this permutation is better than currentBest one.</p>

<pre><code>    def currentBest(newCost):
        if newCost &lt; currentBest:
            currentBest = newCost
        return currentBest
</code></pre>

<p>But the first time i run though this code currentBest will not have a value so i guess i have to assign it a value first but it has to remember the currentBest value for the other permutation so making a currentBest = 999 at the top of the code I don't think will work.</p>

<p>Thank you</p>
