(a: PyIter, b: PyObjectRef, vm: &VirtualMachine)
| 177 | |
| 178 | #[pyfunction(name = "countOf")] |
| 179 | fn count_of(a: PyIter, b: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> { |
| 180 | let mut count: usize = 0; |
| 181 | for element in a.iter_without_hint::<PyObjectRef>(vm)? { |
| 182 | let element = element?; |
| 183 | if element.is(&b) || vm.bool_eq(&b, &element)? { |
| 184 | count += 1; |
| 185 | } |
| 186 | } |
| 187 | Ok(count) |
| 188 | } |
| 189 | |
| 190 | #[pyfunction] |
| 191 | fn delitem(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { |