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

Function dist

crates/stdlib/src/math.rs:238–245  ·  view source on GitHub ↗
(p: Vec<ArgIntoFloat>, q: Vec<ArgIntoFloat>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

236
237 #[pyfunction]
238 fn dist(p: Vec<ArgIntoFloat>, q: Vec<ArgIntoFloat>, vm: &VirtualMachine) -> PyResult<f64> {
239 let p = ArgIntoFloat::vec_into_f64(p);
240 let q = ArgIntoFloat::vec_into_f64(q);
241 if p.len() != q.len() {
242 return Err(vm.new_value_error("both points must have the same number of dimensions"));
243 }
244 Ok(pymath::math::dist(&p, &q))
245 }
246
247 #[pyfunction]
248 fn sin(x: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> {

Callers 1

testDistMethod · 0.85

Calls 2

ErrClass · 0.50
lenMethod · 0.45

Tested by 1

testDistMethod · 0.68