Skip to content

Commit 5786a06

Browse files
committed
Update itertools count repr
1 parent 3f8eb24 commit 5786a06

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

vm/src/stdlib/itertools.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,12 @@ mod decl {
221221

222222
#[pymethod(magic)]
223223
fn repr(&self, vm: &VirtualMachine) -> PyResult<String> {
224-
let mut cur = format!("{}", self.cur.read().clone().repr(vm)?);
225-
let step = format!("{}", self.step.clone());
226-
if step != "1" {
227-
cur.push_str(", ");
228-
cur.push_str(&step);
224+
let cur = format!("{}", self.cur.read().clone().repr(vm)?);
225+
let step = self.step.as_u32_mask().clone();
226+
if step == 1 {
227+
return Ok(format!("count({})", cur));
229228
}
230-
Ok(format!("count({})", cur))
229+
Ok(format!("count({}, {})", cur, step.to_string()))
231230
}
232231
}
233232
impl IterNextIterable for PyItertoolsCount {}

0 commit comments

Comments
 (0)