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

Method concat

crates/vm/src/protocol/sequence.rs:155–172  ·  view source on GitHub ↗
(self, other: &PyObject, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

153 }
154
155 pub fn concat(self, other: &PyObject, vm: &VirtualMachine) -> PyResult {
156 if let Some(f) = self.slots().concat.load() {
157 return f(self, other, vm);
158 }
159
160 // if both arguments appear to be sequences, try fallback to __add__
161 if self.check() && other.sequence_unchecked().check() {
162 let ret = vm.binary_op1(self.obj, other, PyNumberBinaryOp::Add)?;
163 if let PyArithmeticValue::Implemented(ret) = PyArithmeticValue::from_object(vm, ret) {
164 return Ok(ret);
165 }
166 }
167
168 Err(vm.new_type_error(format!(
169 "'{}' object can't be concatenated",
170 self.obj.class()
171 )))
172 }
173
174 pub fn repeat(self, n: isize, vm: &VirtualMachine) -> PyResult {
175 if let Some(f) = self.slots().repeat.load() {

Callers

nothing calls this directly

Calls 7

sequence_uncheckedMethod · 0.80
binary_op1Method · 0.80
fFunction · 0.50
ErrClass · 0.50
loadMethod · 0.45
slotsMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected