Avoid list.insert
Instead of list.insert, appending to a slice is shorter:
L.insert(i,x) L[:i]+=x, For example:
>>> L = [1, 2, 3, 4] >>> L[:-2]+=5, >>> L [1, 2, 5, 3, 4] >>> L[:0]+=6, >>> L [6, 1, 2, 5, 3, 4] list.insertInstead of list.insert, appending to a slice is shorter:
L.insert(i,x) L[:i]+=x, For example:
>>> L = [1, 2, 3, 4] >>> L[:-2]+=5, >>> L [1, 2, 5, 3, 4] >>> L[:0]+=6, >>> L [6, 1, 2, 5, 3, 4]