New submission from Jos Dechamps: After creating a list of lists, changing one element, leads to changes of all the elements:
>>> v=[[]]*10 >>> v [[], [], [], [], [], [], [], [], [], []] >>> v[3].append(3) >>> v [[3], [3], [3], [3], [3], [3], [3], [3], [3], [3]] >>> >>> v=[[]]*10 >>> v [[], [], [], [], [], [], [], [], [], []] >>> v[3] += [3] >>> v [[3], [3], [3], [3], [3], [3], [3], [3], [3], [3]] >>> ---------- components: Interpreter Core messages: 246450 nosy: dechamps priority: normal severity: normal status: open title: Wrong behavior for list of lists type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24589> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com