Message88989
Is this a bug ?
>>> a = [[1,2],[3,4],[5,6]]
>>> a
[[1, 2], [3, 4], [5, 6]]
>>> b = a[0]
>>> b
[1, 2]
>>> b[0] = -8888
>>> b
[-8888, 2]
>>> a
[[-8888, 2], [3, 4], [5, 6]]
>>>
Created a new variable (b) which refers to an element in a list (a).
Changing the value of the new variable also reflects in the original
list. I thought the new variable is actually a new variable with its own
memory allocation and not a symbolic link to pre-existing data. is this
a bug?
Please help. |
|
Date |
User |
Action |
Args |
2009-06-06 07:04:03 | pushkarparanjpe | set | recipients:
+ pushkarparanjpe |
2009-06-06 07:04:03 | pushkarparanjpe | set | messageid: <1244271843.74.0.384598823496.issue6219@psf.upfronthosting.co.za> |
2009-06-06 07:04:01 | pushkarparanjpe | link | issue6219 messages |
2009-06-06 07:04:00 | pushkarparanjpe | create | |
|