New submission from Andrew Barnert: Some of the modules in collections.abc have a subclass hook that implicitly registers any type that declares the right methods, like Iterator. Others do not, like Sequence. For those that do have the hook, it's not always obvious what methods are tested. And some of them test the methods for truthiness, others only for existence (although #25958 will fix that last bit).
The documentation doesn't even mention this, much less describe which ABCs are of which kind. For someone who just wants to know how to write isinstance(arg, Iterable), that's fine. But anyone who wants to create new classes, or integrate third-party classes that weren't ABC-friendly, has to read the collections.abc module source to figure out what they want to do. ---------- assignee: docs@python components: Documentation messages: 257577 nosy: abarnert, docs@python priority: normal severity: normal status: open title: collections.abc documentation incomplete type: enhancement versions: Python 3.6 _______________________________________ Python tracker <[email protected]> <http://bugs.python.org/issue26019> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
