Terry J. Reedy <tjre...@udel.edu> added the comment:
Test01.py runs as expected with no exceptions. This issue appears to be based on a misunderstanding of one or both of two things: a) multiplying an empty list does nothing other than returning a new empty list. b) list.insert(index, value) treats the index as a slice index. This is specified in the doc by "same as s[index:index] = [value]". (I spelled out the parameter names.) https://docs.python.org/3/library/stdtypes.html#mutable-sequence-types >>> l1, l2 = [], [] >>> l1.insert(6, 0); l2[6:6] = [0] >>> l1, l2 ([0], [0]) ---------- nosy: +terry.reedy resolution: -> not a bug stage: -> resolved status: open -> closed type: -> behavior _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40022> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com