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

Method cmp

crates/vm/src/builtins/str.rs:1558–1569  ·  view source on GitHub ↗
(
        zelf: &Py<Self>,
        other: &PyObject,
        op: PyComparisonOp,
        _vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

1556
1557impl Comparable for PyStr {
1558 fn cmp(
1559 zelf: &Py<Self>,
1560 other: &PyObject,
1561 op: PyComparisonOp,
1562 _vm: &VirtualMachine,
1563 ) -> PyResult<PyComparisonValue> {
1564 if let Some(res) = op.identical_optimization(zelf, other) {
1565 return Ok(res.into());
1566 }
1567 let other = class_or_notimplemented!(Self, other);
1568 Ok(op.eval_ord(zelf.as_wtf8().cmp(other.as_wtf8())).into())
1569 }
1570}
1571
1572impl Iterable for PyStr {

Callers 1

replaceMethod · 0.45

Calls 3

eval_ordMethod · 0.80
as_wtf8Method · 0.45

Tested by

no test coverage detected