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

Method count

crates/vm/src/builtins/tuple.rs:394–402  ·  view source on GitHub ↗
(&self, needle: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

392
393 #[pymethod]
394 fn count(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> {
395 let mut count: usize = 0;
396 for element in self {
397 if vm.identical_or_equal(element, &needle)? {
398 count += 1;
399 }
400 }
401 Ok(count)
402 }
403
404 #[inline]
405 pub const fn __len__(&self) -> usize {

Callers

nothing calls this directly

Calls 1

identical_or_equalMethod · 0.80

Tested by

no test coverage detected