Changes by Terry J. Reedy tjre...@udel.edu:
--
Removed message: http://bugs.python.org/msg184008
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14707
___
Roundup Robot added the comment:
New changeset c162e2ff15bd by Terry Jan Reedy in branch '2.7':
Issue #14707: add news entry
http://hg.python.org/cpython/rev/c162e2ff15bd
--
nosy: +python-dev
___
Python tracker rep...@bugs.python.org
Daniel543 superplayer_...@163.com added the comment:
Thank u both.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14707
___
___
Python-bugs-list
New submission from Daniel543 superplayer_...@163.com:
Python 2.7.3 (default, Apr 20 2012, 22:44:07)
[GCC 4.6.3] on linux2
Type help, copyright, credits or license for more information.
a = ['1']
b = []
c = a
b.append(a)
a
['1']
b
[['1']]
c
['1']
a = ['2']
c.extend(a)
b
[['1', '2']]
Martin v. Löwis mar...@v.loewis.de added the comment:
This is correct behavior, because:
b[0] is c
True
(read up on the meaning of the is operator, if this is not a convincing proof
to you).
--
nosy: +loewis
resolution: - invalid
status: open - closed
Ezio Melotti ezio.melo...@gmail.com added the comment:
a = ['1']
b = []
c = a
# now c and a refer to the same object
b.append(a)
# this object is appended to b
a
['1']
b
[['1']]
c
['1']
# a and c refer to the same object you have in b
# so all these ['1'] are actually the same object
a =