Function
index_of
(a: PyIter, b: PyObjectRef, vm: &VirtualMachine)
Source from the content-addressed store, hash-verified
| 199 | |
| 200 | #[pyfunction(name = "indexOf")] |
| 201 | fn index_of(a: PyIter, b: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> { |
| 202 | for (index, element) in a.iter_without_hint::<PyObjectRef>(vm)?.enumerate() { |
| 203 | let element = element?; |
| 204 | if element.is(&b) || vm.bool_eq(&b, &element)? { |
| 205 | return Ok(index); |
| 206 | } |
| 207 | } |
| 208 | Err(vm.new_value_error("sequence.index(x): x not in sequence")) |
| 209 | } |
| 210 | |
| 211 | #[pyfunction] |
| 212 | fn setitem( |
Callers
nothing calls this directly
Tested by
no test coverage detected