Raymond Hettinger added the comment:

I don't think this is a bug.  The purpose collections.abc.Reversible is to 
recognize type where the behavior has been guaranteed, not to recognize all 
types where it happens to work.

Part of the original reason for introducing ABCs in the first place was that in 
general there is no reliable way to detect whether a class defining __getitem__ 
is a sequence or a mapping.

A creator of such a class either needs to subclass from Sequence or register as 
a Sequence.  The fact that reversed(Counter(10)) happens to work is no more 
interesting that the fact Counter(10)[5] happens to work eventhough 
isinstance(Counter, Sequence) returns False.

----------
assignee:  -> rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29727>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to