How do I find out if a integer variable in python has an out of scope hidden value?
<p>in the code here
<a href="https://stackoverflow.com/questions/35262464/how-do-i-force-static-methods-to-use-local-not-global-variables-in-python?noredirect=1">How do I force static methods to use local not global variables in Python?</a></p>

<p>i have a variable that is being passed between methods besides the one in the question. the variable is <code>current_line</code></p>

<pre><code>def line_tocsv(csv_dict={}, line={}, current_line=0):
    csv_line, current_line = LineHandler.create_csv(current_line, kline)
    if current_line in csv_dict:
        csv_dict[current_line].update(csv_line)
    else:
        csv_dict[current_line] = csv_line 
    return csv_dict
</code></pre>

<p>when this code is run, it produced an output simmilar to this</p>

<pre><code>&gt;&gt;&gt; a={0:{"aa":1,"bb":"wasd"},1:{"aa":1,"bb":"wasd"}} 
&gt;&gt;&gt; a
{0: {'aa': 1, 'bb': 'wasd'}, 1: {'aa': 1, 'bb': 'wasd'}}
&gt;&gt;&gt; a[1].update({"cc":"foo"})
&gt;&gt;&gt; a
{0: {'aa': 1, 'cc': 'foo' 'bb': 'wasd'}, 1: {'aa': 1, 'cc': 'foo', 'bb': 'wasd'}}
</code></pre>

<p>how do i make it so that the csv_line dict is only entered into ONE sub dict?!
changing the variable names does not work and i suspect it is because only the references are passed between functions, but i dont know enough python to know where those references actually go and what their order of ops etc is</p>