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

Function concat

crates/vm/src/stdlib/_operator.rs:161–171  ·  view source on GitHub ↗
(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

159
160 #[pyfunction]
161 fn concat(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine) -> PyResult {
162 // Best attempt at checking that a is sequence-like.
163 if !a.class().has_attr(identifier!(vm, __getitem__))
164 || a.fast_isinstance(vm.ctx.types.dict_type)
165 {
166 return Err(
167 vm.new_type_error(format!("{} object can't be concatenated", a.class().name()))
168 );
169 }
170 vm._add(&a, &b)
171 }
172
173 #[pyfunction]
174 fn contains(a: PyObjectRef, b: PyObjectRef, vm: &VirtualMachine) -> PyResult<bool> {

Callers

nothing calls this directly

Calls 5

fast_isinstanceMethod · 0.80
ErrClass · 0.50
has_attrMethod · 0.45
classMethod · 0.45
_addMethod · 0.45

Tested by

no test coverage detected