On Thu, Jun 6, 2019 at 6:31 AM Ryan Gonzalez <rym...@gmail.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[0], L[1],...L[len(L)] = M[0],M[1],...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.
Python-Ideas mailing list -- python-dev(a)python.org
To unsubscribe send an email to python-ideas-leave(a)python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/

Reply via email to