Message267456
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. |
|
Date |
User |
Action |
Args |
2016-06-05 18:45:09 | JelleZijlstra | set | recipients:
+ JelleZijlstra, rhettinger, docs@python, xiang.zhang |
2016-06-05 18:45:09 | JelleZijlstra | set | messageid: <1465152309.73.0.0854071801086.issue27215@psf.upfronthosting.co.za> |
2016-06-05 18:45:09 | JelleZijlstra | link | issue27215 messages |
2016-06-05 18:45:09 | JelleZijlstra | create | |
|