[New-bugs-announce] [issue14707] extend() puzzled me.

Daniel543 report at bugs.python.org
Wed May 2 18:15:16 CEST 2012


New submission from Daniel543 <superplayer_dan at 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']]
>>> c
['1', '2']
>>> a
['2']
>>> 

Is this wrong? I think the "b" should not change.

----------
components: None
messages: 159807
nosy: Daniel543
priority: normal
severity: normal
status: open
title: extend() puzzled me.
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14707>
_______________________________________


More information about the New-bugs-announce mailing list