From 5bbba5d008ffe6f26ffe4fb9e7c7b3e0765a2b0a Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 25 Oct 2022 16:08:28 +0300 Subject: [PATCH] `Collection` is `Sized` (#8977) --- stdlib/builtins.pyi | 2 +- stdlib/typing.pyi | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 3aa14e429..94bf8a218 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -805,7 +805,7 @@ class bytearray(MutableSequence[int], ByteString): def __alloc__(self) -> int: ... @final -class memoryview(Sized, Sequence[int]): +class memoryview(Sequence[int]): @property def format(self) -> str: ... @property diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index d17a9d08f..d03a3eabb 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -452,10 +452,7 @@ class Container(Protocol[_T_co]): def __contains__(self, __x: object) -> bool: ... @runtime_checkable -class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]): - # Implement Sized (but don't have it as a base class). - @abstractmethod - def __len__(self) -> int: ... +class Collection(Sized, Iterable[_T_co], Container[_T_co], Protocol[_T_co]): ... class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]): @overload