On Fri, 3 Jul 2020 at 03:07, Random832 random832@fastmail.com wrote:
On Wed, Jul 1, 2020, at 08:23, Joao S. O. Bueno wrote:
collections.mixins.SlicedSequence that would override `__delitem__`, `__setitem__` and `__getitem__` and handle slices could pair up with the "ComparableSequence" - people could use these "a la carte", and no backwards compatibility would be hurt.
This one raises the question of where you put the single-item accessors.
Really - I think I had worked on this once, but the slicing support was via decorators.
And sliced __delitem__ may be difficult to implement efficiently without knowing the internals of the sequence type.
Indeed, as would __setitem__ inserting asequence larger than the target slice - (or shorter). There are log of corner cases there hard to get right.
But, yes, it would be so inefficient that probably it is better left for a 3rdy party package than the stdlib. So - let's just drop these out of the proposal and maybe check if Sequence.__eq__ is worth it.
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/7HLNBV... Code of Conduct: http://python.org/psf/codeofconduct/