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

Method __length_hint__

crates/vm/src/builtins/enumerate.rs:111–119  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

109
110 #[pymethod]
111 fn __length_hint__(&self, vm: &VirtualMachine) -> PyResult<usize> {
112 let internal = self.internal.lock();
113 if let IterStatus::Active(obj) = &internal.status
114 && internal.position <= obj.length(vm)?
115 {
116 return Ok(internal.position + 1);
117 }
118 Ok(0)
119 }
120
121 #[pymethod]
122 fn __setstate__(&self, state: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {

Callers

nothing calls this directly

Calls 2

lockMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected