Add itertools count repr (#3784)

This commit is contained in:
oow214
2022-06-13 23:52:26 +09:00
committed by GitHub
parent f624e8e78b
commit 7848e06a41

View File

@@ -202,6 +202,13 @@ mod decl {
fn reduce(zelf: PyRef<Self>) -> (PyTypeRef, (BigInt,)) {
(zelf.class().clone(), (zelf.cur.read().clone(),))
}
#[pymethod(magic)]
fn repr(&self) -> PyResult<String> {
let cur = self.cur.read();
Ok(format!("count({})", cur))
}
}
impl IterNextIterable for PyItertoolsCount {}
impl IterNext for PyItertoolsCount {