[docs] [issue27215] Docstrings of Sequence and MutableSequence seems not right

Jelle Zijlstra report at bugs.python.org
Sun Jun 5 14:45:09 EDT 2016

Jelle Zijlstra added the comment:

The docstrings (at least in 3.6) say subclasses must override __new__ *or* __init__. However, I think this is wrong too. The following is a correct (if not very useful) implementation of Sequence:

>>> import collections.abc
>>> class MySequence(collections.abc.Sequence):
...     def __getitem__(self, key):
...             raise IndexError(key)
...     def __len__(self):
...             return 0

Other abc docstrings also don't claim that __init__ or __new__ must be implemented. The attached patch fixes the docstrings.

keywords: +patch
nosy: +Jelle Zijlstra
Added file: http://bugs.python.org/file43245/issue27215.patch

Python tracker <report at bugs.python.org>

More information about the docs mailing list