[issue16712] collections.abc.Sequence should not provide __reversed__

2019-04-11 Thread Inada Naoki
Inada Naoki added the comment: I close this issue because Reversible ABC was added. It's sad that Sequnce.__reversed__ is just makes reversed() slow without any benefit. But removing it without breaking backward compatibility is not easy for now. -- resolution: -> wont fix stage: n

[issue16712] collections.abc.Sequence should not provide __reversed__

2012-12-25 Thread INADA Naoki
INADA Naoki added the comment: __contains__ is required for Container. So there is a clear reason to define it. Additionaly, http://docs.python.org/3.3/reference/datamodel.html#object.__contains__ doesn't discourage to implement slower pure-python method. In case of __reversed__, I can't find

[issue16712] collections.abc.Sequence should not provide __reversed__

2012-12-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Guido put a number of non-optimal implementations in the ABCs. His goal was to define the interface and to supply a working default implementation (see MutableMapping.clear() for a prime example). In the case of __reversed__(), it is unfortunate that it sl

[issue16712] collections.abc.Sequence should not provide __reversed__

2012-12-22 Thread Nick Coghlan
Nick Coghlan added the comment: The observation about it incorrectly flagging __reversed__ as an expected method for Sequence objects is also valid. -- ___ Python tracker ___ __

[issue16712] collections.abc.Sequence should not provide __reversed__

2012-12-22 Thread Nick Coghlan
Nick Coghlan added the comment: This sounds like a legitimate complaint to me, as the one in the ABC will be at least marginally slower in CPython since it's written in Python while reversed uses a builtin C implementation. Classing it as an enhancement rather than a behavioural bug though, as

[issue16712] collections.abc.Sequence should not provide __reversed__

2012-12-21 Thread INADA Naoki
INADA Naoki added the comment: I believe that using Sequence ABC as mix-in is recommended when implementing custom sequence. But mixing-in it violates "should only provide __reversed__() if they can provide an implementation that is more efficient than the one provided by reversed()." Defini

[issue16712] collections.abc.Sequence should not provide __reversed__

2012-12-21 Thread Terry J. Reedy
Terry J. Reedy added the comment: I would expect that the default method of reversed() and collections.abc.Sequence.__reverse__ are more or less the same. If so, this should be closed as invalid. But I want to hear from the abc experts. -- nosy: +rhettinger, stutzbach, terry.reedy vers

[issue16712] collections.abc.Sequence should not provide __reversed__

2012-12-18 Thread INADA Naoki
New submission from INADA Naoki: http://docs.python.org/3.3/reference/datamodel.html#object.__reversed__ > Objects that support the sequence protocol should only provide > __reversed__() if they can provide an implementation that is more efficient > than the one provided by reversed(). collec