Message364722
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]) |
|
Date |
User |
Action |
Args |
2020-03-20 23:36:20 | terry.reedy | set | recipients:
+ terry.reedy, paul.moore, tim.golden, zach.ware, steve.dower, yepan Li |
2020-03-20 23:36:20 | terry.reedy | set | messageid: <1584747380.06.0.225322877201.issue40022@roundup.psfhosted.org> |
2020-03-20 23:36:20 | terry.reedy | link | issue40022 messages |
2020-03-20 23:36:19 | terry.reedy | create | |
|