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

Raymond Hettinger report at bugs.python.org
Tue Jul 28 01:14:44 EDT 2020


Raymond Hettinger <raymond.hettinger at gmail.com> 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.Set will accept any iterable, but the concrete does not.  

We use the Liskov substitution principle as a guide, not as a law.  In a number of cases, we choose practicality-beats-purity and allow subclasses to differ in ways than their parents.  Counter() doesn't support fromkeys().  OrderedDict.popitem() has different signature than dict.popitem().

Hope that insight was helpful.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41409>
_______________________________________


More information about the Python-bugs-list mailing list