From 7848e06a419ee614f6ffad985b549f2ff2b4f3f2 Mon Sep 17 00:00:00 2001 From: oow214 <83155697+oow214@users.noreply.github.com> Date: Mon, 13 Jun 2022 23:52:26 +0900 Subject: [PATCH] Add itertools count repr (#3784) --- vm/src/stdlib/itertools.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vm/src/stdlib/itertools.rs b/vm/src/stdlib/itertools.rs index ed02cc5a6..cc4eeb2d0 100644 --- a/vm/src/stdlib/itertools.rs +++ b/vm/src/stdlib/itertools.rs @@ -202,6 +202,13 @@ mod decl { fn reduce(zelf: PyRef) -> (PyTypeRef, (BigInt,)) { (zelf.class().clone(), (zelf.cur.read().clone(),)) } + + #[pymethod(magic)] + fn repr(&self) -> PyResult { + let cur = self.cur.read(); + + Ok(format!("count({})", cur)) + } } impl IterNextIterable for PyItertoolsCount {} impl IterNext for PyItertoolsCount {