MCPcopy Index your code
hub / github.com/RustPython/RustPython / iter

Function iter

crates/vm/src/stdlib/builtins.rs:765–779  ·  view source on GitHub ↗
(
        iter_target: PyObjectRef,
        sentinel: OptionalArg<PyObjectRef>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

763
764 #[pyfunction]
765 fn iter(
766 iter_target: PyObjectRef,
767 sentinel: OptionalArg<PyObjectRef>,
768 vm: &VirtualMachine,
769 ) -> PyResult<PyIter> {
770 if let OptionalArg::Present(sentinel) = sentinel {
771 let callable = ArgCallable::try_from_object(vm, iter_target)?;
772 let iterator = PyCallableIterator::new(callable, sentinel)
773 .into_ref(&vm.ctx)
774 .into();
775 Ok(PyIter::new(iterator))
776 } else {
777 iter_target.get_iter(vm)
778 }
779 }
780
781 #[pyfunction]
782 fn aiter(iter_target: PyObjectRef, vm: &VirtualMachine) -> PyResult {

Callers 15

reduceFunction · 0.85
registerFunction · 0.85
__iter__Method · 0.85
_join_translated_partsFunction · 0.85
__iter__Method · 0.85
getblockFunction · 0.85
_bindMethod · 0.85
harmonic_meanFunction · 0.85
modeFunction · 0.85
multimodeFunction · 0.85
__iter__Method · 0.85

Calls 3

newFunction · 0.85
get_iterMethod · 0.80
into_refMethod · 0.45

Tested by 15

test_throws_in_iterMethod · 0.68
test_patma_055Method · 0.68
__reduce__Method · 0.68
openhookMethod · 0.68
testcontextMethod · 0.68
test_len_cyclesMethod · 0.68
test_len_raceMethod · 0.68
run_testFunction · 0.68
__anext__Method · 0.68
test_maxlenMethod · 0.68