New submission from Anup Parikh <[email protected]>:
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 import Iterable, Protocol
class IterableWithMethod(Iterable, Protocol):
def method(self) -> None: pass
Since the ABCs don't provide any default implementations (I think?), maybe they
should just be defined as runtime checkable protocols instead of ABCs?
----------
components: Library (Lib), Parser
messages: 400387
nosy: anuppari, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Cannot extend collections ABCs with protocol
type: behavior
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45024>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com