I have the following problem.
Given a list of integers, I need to generate all of the sublists
L[k:], without generating copies.
for k in [0, len(L) - 1]
Slicing lists does not generate copies of the objects in the list; it just copies the references to them.
I had a moment of uncertainty about immutable objects; but I checked and indeed, only the reference is copied:
>>> a = [1, 2, 3] >>> b = a[1:3] >>> id(a) 143727964 >>> id(b) 143727964