From 6b36b1befef5ffca2f524aca6448009ec92a894b Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sun, 17 Jun 2018 04:00:42 -0700 Subject: [PATCH] `Iterator` provides a concrete `__iter__` in 2.7 (#2245) This is already how it works in the Python 3 stub. `Iterator.__iter__` also exists at runtime: https://github.com/python/cpython/blob/2.7/Lib/_abcoll.py#L73. --- stdlib/2/typing.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/2/typing.pyi b/stdlib/2/typing.pyi index cc314d4fc..519a96d9d 100644 --- a/stdlib/2/typing.pyi +++ b/stdlib/2/typing.pyi @@ -118,6 +118,7 @@ class Iterable(Protocol[_T_co]): class Iterator(Iterable[_T_co], Protocol[_T_co]): @abstractmethod def next(self) -> _T_co: ... + def __iter__(self) -> Iterator[_T_co]: ... class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]): @abstractmethod