Skip to content

Commit 7df48a8

Browse files
committed
Revert "Collection is Sized (python#8977)"
This reverts commit 5bbba5d.
1 parent a74df38 commit 7df48a8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

stdlib/builtins.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ class bytearray(MutableSequence[int], ByteString):
804804
def __alloc__(self) -> int: ...
805805

806806
@final
807-
class memoryview(Sequence[int]):
807+
class memoryview(Sized, Sequence[int]):
808808
@property
809809
def format(self) -> str: ...
810810
@property

stdlib/typing.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,10 @@ class Container(Protocol[_T_co]):
452452
def __contains__(self, __x: object) -> bool: ...
453453

454454
@runtime_checkable
455-
class Collection(Sized, Iterable[_T_co], Container[_T_co], Protocol[_T_co]): ...
455+
class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]):
456+
# Implement Sized (but don't have it as a base class).
457+
@abstractmethod
458+
def __len__(self) -> int: ...
456459

457460
class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
458461
@overload

0 commit comments

Comments
 (0)