[issue12597] List created by multiplication behaves different

Сергій Загорія report at bugs.python.org
Wed Jul 20 18:38:59 CEST 2011


New submission from Сергій Загорія <xintx.ua at gmail.com>:

Next code:

def ill(row):
  row[1]=1
list_manual=[[0,0,0],[0,0,0],[0,0,0]]
list_generated=[[0,0,0]]*3
ill(list_manual[1])
print(list_manual)
ill(list_generated[1])
print(list_generated)

Will output:

[[0, 0, 0], [0, 1, 0], [0, 0, 0]]
[[0, 1, 0], [0, 1, 0], [0, 1, 0]]

Is it a bug?

----------
messages: 140753
nosy: xintx-ua
priority: normal
severity: normal
status: open
title: List created by multiplication behaves different
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

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


More information about the Python-bugs-list mailing list