[issue45024] Cannot extend collections ABCs with protocol

2021-10-04 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset 9d8a64a7ccebb288094d4e9da66f30d2ada9a973 by Pablo Galindo (Miss Islington (bot)) in branch '3.10': bpo-45024 and bpo-23864: Document how interface testing works with the collections ABCs (GH-28218) (GH-28266)

[issue45024] Cannot extend collections ABCs with protocol

2021-09-09 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10, Python 3.11 ___ Python tracker

[issue45024] Cannot extend collections ABCs with protocol

2021-09-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 89edd18779e382c5fa7f57722b0b897a907ed2c4 by Miss Islington (bot) in branch '3.10': bpo-45024 and bpo-23864: Document how interface testing works with the collections ABCs (GH-28218) (GH-28266)

[issue45024] Cannot extend collections ABCs with protocol

2021-09-09 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 6.0 -> 7.0 pull_requests: +26686 pull_request: https://github.com/python/cpython/pull/28266 ___ Python tracker

[issue45024] Cannot extend collections ABCs with protocol

2021-09-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 62fa613f6a6e872723505ee9d56242c31a654a9d by Raymond Hettinger in branch 'main': bpo-45024 and bpo-23864: Document how interface testing works with the collections ABCs (GH-28218)

[issue45024] Cannot extend collections ABCs with protocol

2021-09-07 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +26643 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28218 ___ Python tracker

[issue45024] Cannot extend collections ABCs with protocol

2021-09-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: The docs need to clarify which ABCs can satisfy isinstance() based solely on hasattr() logic and which ABCs require registration or direct subclassing. The docs should also explain why the more complex ABCs can't reliably be recognized based on the

[issue45024] Cannot extend collections ABCs with protocol

2021-09-02 Thread Ken Jin
Ken Jin added the comment: I suspect this may be intentional. See related issues https://bugs.python.org/issue35190 and https://bugs.python.org/issue23864. Copying verbatim from what Ivan said in the first issue: " The separation may look arbitrary, but the idea is quite simple. Only those

[issue45024] Cannot extend collections ABCs with protocol

2021-08-28 Thread Anup Parikh
Anup Parikh added the comment: Yeah, you got the gist of what I meant, though, I guess that was a confusing example since there are apparently protocols for Iterable. But not for many of the other collection ABCs such as Sequence, e.g., the following doesn't work: from typing import

[issue45024] Cannot extend collections ABCs with protocol

2021-08-28 Thread Ken Jin
Ken Jin added the comment: Thanks for the bug report Anup. I'm mildly confused by what you meant, so please help me here: I interpreted your request as wanting any type that implements `method` and `__iter__` to be considered a subtype of `IterableWithMethod`. But this already works at

[issue45024] Cannot extend collections ABCs with protocol

2021-08-26 Thread Anup Parikh
New submission from Anup Parikh : Since the container ABCs are normal classes, and Protocol cannot subclass normal classes, there's no way to create a protocol that extends the ABCs without explicitly listing out all the methods needed for the collection. e.g., can't do this: from typing