The problem as I see it with slice assignment is that if we want to operator to mean type defined assignment not necessary in place assignment. It creates confusion for types which have __setitem__. Caleb Donovick On Thu, Jun 6, 2019 at 4:59 PM Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
Stephen J. Turnbull wrote:
L[m:m+k] specifies that a list operation will take place on the k elements starting with m. As a value, it makes a new list of references to those elements.
Even that is specific to lists. There's no requirement that a RHS slice has to create new references to elements. A type can define it so that it returns a mutable view of part of the original object. This is how numpy arrays behave, for example.
As syntax, slice notation simply denotes a range of elements, and it does that the same way whether it's on the LHS or RHS.
-- Greg _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/HF3RYO... Code of Conduct: http://python.org/psf/codeofconduct/