Skip to content

Commit 7848e06

Browse files
authored
Add itertools count repr (RustPython#3784)
1 parent f624e8e commit 7848e06

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

vm/src/stdlib/itertools.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ mod decl {
202202
fn reduce(zelf: PyRef<Self>) -> (PyTypeRef, (BigInt,)) {
203203
(zelf.class().clone(), (zelf.cur.read().clone(),))
204204
}
205+
206+
#[pymethod(magic)]
207+
fn repr(&self) -> PyResult<String> {
208+
let cur = self.cur.read();
209+
210+
Ok(format!("count({})", cur))
211+
}
205212
}
206213
impl IterNextIterable for PyItertoolsCount {}
207214
impl IterNext for PyItertoolsCount {

0 commit comments

Comments
 (0)