Skip Montanaro added the comment:
Not a bug. The two elements of w are references to the same list:
>>> w = [[0] * 2] * 2
>>> w
[[0, 0], [0, 0]]
>>> [id(elt) for elt in w]
[21743952, 21743952]
--
nosy: +skip.montanaro
resolution: -> not a bug
status: open -> closed
___
New submission from vasya yugov:
This code:
w = [[0] * 2] * 2
w[1][1] = 1
print(w)
prints
[[0, 1], [0, 1]]
Is it a bug?
--
components: Macintosh
messages: 245460
nosy: ned.deily, ronaldoussoren, vasya yugov
priority: normal
severity: normal
status: open
title: Python 3.4 bugs
type: beh