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

Method symmetric_difference

crates/vm/src/builtins/set.rs:274–289  ·  view source on GitHub ↗
(
        &self,
        other: ArgIterable,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

272 }
273
274 pub(super) fn symmetric_difference(
275 &self,
276 other: ArgIterable,
277 vm: &VirtualMachine,
278 ) -> PyResult<Self> {
279 let new_inner = self.clone();
280
281 // We want to remove duplicates in other
282 let other_set = Self::from_iter(other.iter(vm)?, vm)?;
283
284 for item in other_set.elements() {
285 new_inner.content.delete_or_insert(vm, &item, ())?
286 }
287
288 Ok(new_inner)
289 }
290
291 fn issuperset(&self, other: ArgIterable, vm: &VirtualMachine) -> PyResult<bool> {
292 for item in other.iter(vm)? {

Callers 2

__xor__Method · 0.45
set_inner_number_xorFunction · 0.45

Calls 6

delete_or_insertMethod · 0.80
fold_opMethod · 0.80
cloneMethod · 0.45
iterMethod · 0.45
elementsMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected