[issue42223] List repetition operator gives unexpected results

2020-10-31 Thread Austin Green
Austin Green added the comment: Thanks for that; I suspected as much. Could not find anything about it searching the web, so it's a feature not much discussed by the numerous Python tutorials. -- ___ Python tracker

[issue42223] List repetition operator gives unexpected results

2020-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug. The sequence repetition operator does not *copy* items, as explained here: https://docs.python.org/3/library/stdtypes.html#common-sequence-operations -- nosy: +steven.daprano resolution: -> not a bug stage: -> resolved status: o

[issue42223] List repetition operator gives unexpected results

2020-10-31 Thread Austin Green
New submission from Austin Green : Not sure if this is a bug, cannot find any clarification in the documentation. Please reassign it if need be. Using the * operator to generate a list of lists: >>> a = [[0]*3]*3 >>> a [[0, 0, 0], [0, 0, 0], [0, 0, 0]] gives a list of 3 lists of zeroes, as ex