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

Method __length_hint__

crates/vm/src/builtins/map.rs:55–61  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

53impl PyMap {
54 #[pymethod]
55 fn __length_hint__(&self, vm: &VirtualMachine) -> PyResult<usize> {
56 self.iterators.iter().try_fold(0, |prev, cur| {
57 let cur = cur.as_ref().to_owned().length_hint(0, vm)?;
58 let max = core::cmp::max(prev, cur);
59 Ok(max)
60 })
61 }
62
63 #[pymethod]
64 fn __reduce__(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<PyTupleRef> {

Callers

nothing calls this directly

Calls 5

maxFunction · 0.85
iterMethod · 0.45
length_hintMethod · 0.45
to_ownedMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected