confusion about variable scope in a class
gyromagnetic at gmail.com
Sat Feb 14 16:53:46 CET 2009
I was writing a Python script to perform some data analyses and was
surprised by some behavior I noted. A simple test program illustrating
the behavior is below.
I do not understand why the value of 'data' is being modified. I am
obviously missing something obvious, and would certainly appreciate an
explanation of why this is happening.
t = data1.pop(-1)
t = data2.pop(-1)
data = range(10)
if __name__ == '__main__':
tp = TestPop()
More information about the Python-list