From 62170653ce8cd2f6de17df03f1e89c0b009496f3 Mon Sep 17 00:00:00 2001 From: James Hilton-Balfe Date: Thu, 12 Jan 2023 22:07:26 +0000 Subject: [PATCH] Add itertools.batched (#9515) --- stdlib/itertools.pyi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/itertools.pyi b/stdlib/itertools.pyi index 7299ee820..3cc1bd00d 100644 --- a/stdlib/itertools.pyi +++ b/stdlib/itertools.pyi @@ -271,3 +271,9 @@ if sys.version_info >= (3, 10): def __new__(cls, __iterable: Iterable[_T]) -> pairwise[tuple[_T, _T]]: ... def __iter__(self: Self) -> Self: ... def __next__(self) -> _T_co: ... + +if sys.version_info >= (3, 12): + class batched(Iterator[_T_co], Generic[_T_co]): + def __new__(cls: type[Self], iterable: Iterable[_T_co], n: int) -> Self: ... + def __iter__(self: Self) -> Self: ... + def __next__(self) -> tuple[_T_co, ...]: ...