This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author anuppari
Recipients JelleZijlstra, anuppari, gvanrossum, kj
Date 2021-08-28.20:35:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630182926.64.0.275200307151.issue45024@roundup.psfhosted.org>
In-reply-to
Content
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 Sequence, Protocol

class SequenceWithMethod(Sequence, Protocol):
    def method(self) -> None: pass

In which case, anything that implements `method`, `__getitem__`, `__len__`, `__contains__`, `__iter__`, `__reversed__`, `index`,  and `count` would be considered a subtype of `SequenceWithMethod`
History
Date User Action Args
2021-08-28 20:35:26anupparisetrecipients: + anuppari, gvanrossum, JelleZijlstra, kj
2021-08-28 20:35:26anupparisetmessageid: <1630182926.64.0.275200307151.issue45024@roundup.psfhosted.org>
2021-08-28 20:35:26anupparilinkissue45024 messages
2021-08-28 20:35:26anupparicreate