Anup Parikh <anupp...@gmail.com> 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 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` ---------- status: pending -> open _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45024> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com