Re: confusion about variable scope in a class

2009-02-14 Thread Diez B. Roggisch
gyro schrieb: Hi, 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 ce

Re: confusion about variable scope in a class

2009-02-14 Thread andrew cooke
it's not a scope issue. you are confusing variables and objects. a variable is a box that can hold an object so x = 2 puts the object '2' in the box 'x'. following that with x = '3' changes the box 'x' to hold the object '3'. but lists are also boxes, different from variables. so x = [1,2,3]

confusion about variable scope in a class

2009-02-14 Thread gyro
Hi, 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 apprecia