Author pushkarparanjpe
Recipients pushkarparanjpe
Date 2009-06-06.07:04:00
SpamBayes Score 0.000609264
Marked as misclassified No
Message-id <1244271843.74.0.384598823496.issue6219@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-06-06 07:04:03pushkarparanjpesetrecipients: + pushkarparanjpe
2009-06-06 07:04:03pushkarparanjpesetmessageid: <1244271843.74.0.384598823496.issue6219@psf.upfronthosting.co.za>
2009-06-06 07:04:01pushkarparanjpelinkissue6219 messages
2009-06-06 07:04:00pushkarparanjpecreate