On Thu, Jun 6, 2019 at 6:31 AM Ryan Gonzalez email@example.com wrote:
Think of it more like indexing a range. Say you have:
L[:] = M[:]
Which is the same as:
L[0:len(L)] = M[0:len(M)]
Which mentally you can think of like:
L, L,...L[len(L)] = M,M,...M[len(M)]
Slicing is just indexing that represents more than one element, and if you think about it like that slice assignment makes much more sense.
This makes definitely sense on its own right. Problem is, when it moves to the right hand side, it means exactly the opposite: instead of indexing the full range of L, it is now representing a copy of L (X = L[:]). So L[:] = thing vs thing = L[:], although in both assignment L shows up exactly the same: L[:], but means completely different things.