Given that:
l = [1,2,3,4,5]
What is the difference between l.pop(0) and l = l[1:] if we only consider final state of l?
It seems to me that contents of l should be the same, no matter which option I choose and simple tests seem to show the same, but I have a piece of code which behaves differently based on which operation I use.
I'm using Python 3.6.7 from Anaconda.
EDIT: Code example:
forward = range(10)
backward = forward[::-1]
parts = []
f_p = []
b_p = []
for f, b in zip(forward, backward):
if len(f_p) == 3:
parts.append((f_p, b_p))
f_p = f_p[1:] # f_p.pop(0)
b_p = b_p[1:] # b_p.pop(0)
f_p.append(f)
b_p.append(b)
print(parts)
Why are results different?