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

Method length

crates/vm/src/protocol/object.rs:700–707  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

698 }
699
700 pub fn length(&self, vm: &VirtualMachine) -> PyResult<usize> {
701 self.length_opt(vm).ok_or_else(|| {
702 vm.new_type_error(format!(
703 "object of type '{}' has no len()",
704 self.class().name()
705 ))
706 })?
707 }
708
709 pub fn get_item<K: DictKey + ?Sized>(&self, needle: &K, vm: &VirtualMachine) -> PyResult {
710 if let Some(dict) = self.downcast_ref_if_exact::<PyDict>(vm) {

Callers 10

execute_instructionMethod · 0.45
unpack_sequenceMethod · 0.45
lenFunction · 0.45
reversedFunction · 0.45
readlinesMethod · 0.45
__length_hint__Method · 0.45
__len__Method · 0.45
__length_hint__Method · 0.45
lenMethod · 0.45
length_hint_optMethod · 0.45

Calls 2

ok_or_elseMethod · 0.80
length_optMethod · 0.45

Tested by

no test coverage detected