problematic python function returns
<p>I have a function similar to the following:</p>

<pre><code>def getCost(list):
  cost = 0
  for item in list:
    cost += item
  return cost
</code></pre>

<p>and I call it as so:</p>

<pre><code>cost = getCost([1, 2, 3, 4])
</code></pre>

<p>This is GREATLY simplified but it illustrates what is going on.  No matter what I do, cost always ends up == 0.  If I change the value of cost in the function to say 12, then 12 is returned.  If I debug and look at the value of cost prior to the return, cost == 10</p>

<p>It looks like it is always returning the defined number for cost, and completely disregarding any modifications to it.  Can anyone tell me what would cause this?</p>
