From 4dc21f04dd8c797c20325088837ccab182d5679c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 13 Nov 2018 20:47:48 -0800 Subject: [PATCH] Move Sized earlier in the bases of Sequence (#2602) See https://github.com/rominf/ordered-set-stubs/issues/1: class OrderedSet(MutableSet[T], Sequence[T]): ... works in Python 3, but not in Python 2 -- this fixes that --- stdlib/2/typing.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/2/typing.pyi b/stdlib/2/typing.pyi index 81daad774..ba621d72d 100644 --- a/stdlib/2/typing.pyi +++ b/stdlib/2/typing.pyi @@ -144,7 +144,7 @@ class Container(Protocol[_T_co]): @abstractmethod def __contains__(self, x: object) -> bool: ... -class Sequence(Iterable[_T_co], Container[_T_co], Sized, Reversible[_T_co], Generic[_T_co]): +class Sequence(Sized, Iterable[_T_co], Container[_T_co], Reversible[_T_co], Generic[_T_co]): @overload @abstractmethod def __getitem__(self, i: int) -> _T_co: ...