[issue41409] deque.pop(index) is not supported

2020-07-28 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I am convinced by Raymond's argument, it seems that with the current state of the ABC classes and semantics the most pragmatical solution is the status quo. It would be a weird if deque is a Sequence but not a MutableSequence because it can clearly be

[issue41409] deque.pop(index) is not supported

2020-07-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: > If deque does not fully support the MutableSequence interface, > should not it be un-regitered as MutableSequence? You could unregister it, but for such a minor variance, it isn't worth it. We're not unregistering sets and frozenset from Set even though

[issue41409] deque.pop(index) is not supported

2020-07-28 Thread Akuli
Akuli added the comment: I don't think it's very common to write code that needs to work with any MutableSequence but not with any Sequence. I think that's the only situation where missing support for deque.pop(index) is a problem. Maybe deque should be a Sequence but not a MutableSequence.

[issue41409] deque.pop(index) is not supported

2020-07-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If deque does not fully support the MutableSequence interface, should not it be un-regitered as MutableSequence? Maybe we need other abstract class which would be parent of MutableSequence and deque? -- nosy: +stutzbach ___

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, the relationship between a concrete class and an ABC is normative with respect to core capabilities but isn't 100% strict. Concrete classes can vary in small respects when it makes sense. For example, the __or__ and __and__ methods for collections

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: This was an intentional decision. Deques designed for fast access at the end points. Also, pop() is a core deque operation that needs to be fast. Altering its signature with an optional argument would slow it down. Thank you for the suggestion, but we r

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Jim Jewett
Jim Jewett added the comment: It may well have been intentional, as deques should normally be mutated only at the ends. But Raymond did make changes to conform to the ABC, so this should probably be supported too. Go ahead and include docstrings and/or discouraging it, though, except for i

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: > Hi, I want to start contributing to CPython. Can I take up this issue? Sure, go ahead. Feel free to ping one of us in the PR for review -- nosy: +pablogsal ___ Python tracker

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Shubham Kumar Jha
Shubham Kumar Jha added the comment: Hi, I want to start contributing to CPython. Can I take up this issue? -- nosy: +ShubhamKJha ___ Python tracker ___ __

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Yuan
Yuan added the comment: Same status as slicing support from MutableSequence. -- nosy: +Yuan ___ Python tracker ___ ___ Python-bugs-

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: >>> issubclass(collections.deque, collections.abc.MutableSequence) True >>> sorted(set(dir(collections.abc.MutableSequence)) - >>> set(dir(collections.deque))) ['__abstractmethods__', '__module__', '__slots__', '_abc_impl'] Well, it is a bug. -- ty

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Akuli
Akuli added the comment: I meant MutableSequence instead of MutableMapping. Oops. -- ___ Python tracker ___ ___ Python-bugs-list ma

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: deque is not a subclass of MutableMapping, so the Liskov substitution principle is not related here. deque is not registered as a virtual subclass of MutableMapping and it lacks a number of MutableMapping methods. >>> import collections.abc >>> issubclass

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue41409] deque.pop(index) is not supported

2020-07-27 Thread Akuli
New submission from Akuli : The pop method of collections.deque can't be used like deque.pop(index), even though `del deque[index]` or deque.pop() without an argument works. This breaks the Liskov substitution principle because collections.abc.MutableMapping supports the .pop(index) usage. Is