Skip to content

SetMut

Bases: PyoMutableSet[T], ArgsWrapper[T]


              flowchart TD
              pyochain.core._set.SetMut[SetMut]
              pyochain.abc._mutable_set.PyoMutableSet[PyoMutableSet]
              pyochain.abc._set.PyoSet[PyoSet]
              pyochain.abc._collection.PyoCollection[PyoCollection]
              pyochain.abc._iterable.PyoIterable[PyoIterable]
              pyochain.abc._collection.PyoContainer[PyoContainer]
              pyochain.abc._collection.PyoSized[PyoSized]
              pyochain.abc._mixins.Checkable[Checkable]
              pyochain.abc._mixins.Fluent[Fluent]
              pyochain.abc._mixins.Pipe[Pipe]
              pyochain.abc._mixins.Tap[Tap]
              pyochain.abc.constructors.ArgsWrapper[ArgsWrapper]
              pyochain.abc.constructors.FromArgs[FromArgs]
              pyochain.abc.constructors.FromIter[FromIter]
              pyochain.abc.constructors.Wrapper[Wrapper]

                              pyochain.abc._mutable_set.PyoMutableSet --> pyochain.core._set.SetMut
                                pyochain.abc._set.PyoSet --> pyochain.abc._mutable_set.PyoMutableSet
                                pyochain.abc._collection.PyoCollection --> pyochain.abc._set.PyoSet
                                pyochain.abc._iterable.PyoIterable --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._iterable.PyoIterable
                
                pyochain.abc._mixins.Fluent --> pyochain.abc._iterable.PyoIterable
                                pyochain.abc._mixins.Pipe --> pyochain.abc._mixins.Fluent
                
                pyochain.abc._mixins.Tap --> pyochain.abc._mixins.Fluent
                


                pyochain.abc._collection.PyoContainer --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoContainer
                

                pyochain.abc._collection.PyoSized --> pyochain.abc._collection.PyoCollection
                                pyochain.abc._mixins.Checkable --> pyochain.abc._collection.PyoSized
                




                pyochain.abc.constructors.ArgsWrapper --> pyochain.core._set.SetMut
                                pyochain.abc.constructors.FromArgs --> pyochain.abc.constructors.ArgsWrapper
                                pyochain.abc.constructors.FromIter --> pyochain.abc.constructors.FromArgs
                

                pyochain.abc.constructors.Wrapper --> pyochain.abc.constructors.ArgsWrapper
                



              click pyochain.core._set.SetMut href "" "pyochain.core._set.SetMut"
              click pyochain.abc._mutable_set.PyoMutableSet href "" "pyochain.abc._mutable_set.PyoMutableSet"
              click pyochain.abc._set.PyoSet href "" "pyochain.abc._set.PyoSet"
              click pyochain.abc._collection.PyoCollection href "" "pyochain.abc._collection.PyoCollection"
              click pyochain.abc._iterable.PyoIterable href "" "pyochain.abc._iterable.PyoIterable"
              click pyochain.abc._collection.PyoContainer href "" "pyochain.abc._collection.PyoContainer"
              click pyochain.abc._collection.PyoSized href "" "pyochain.abc._collection.PyoSized"
              click pyochain.abc._mixins.Checkable href "" "pyochain.abc._mixins.Checkable"
              click pyochain.abc._mixins.Fluent href "" "pyochain.abc._mixins.Fluent"
              click pyochain.abc._mixins.Pipe href "" "pyochain.abc._mixins.Pipe"
              click pyochain.abc._mixins.Tap href "" "pyochain.abc._mixins.Tap"
              click pyochain.abc.constructors.ArgsWrapper href "" "pyochain.abc.constructors.ArgsWrapper"
              click pyochain.abc.constructors.FromArgs href "" "pyochain.abc.constructors.FromArgs"
              click pyochain.abc.constructors.FromIter href "" "pyochain.abc.constructors.FromIter"
              click pyochain.abc.constructors.Wrapper href "" "pyochain.abc.constructors.Wrapper"
            

A mutable, unordered collection of unique elements.

Unlike Set which is immutable, SetMut allows in-place modification of elements.

Implement the collections::abc::MutableSet interface, so elements can be modified in place, and passed to any function/object expecting a standard mutable set.

Underlying data structure is a set.

Source code in pyochain/core/_set.pyi
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
class SetMut[T](PyoMutableSet[T], ArgsWrapper[T]):
    """A mutable, unordered collection of unique elements.

    Unlike [`Set`][Set] which is immutable, `SetMut` allows in-place modification of elements.

    Implement the `collections::abc::MutableSet` interface, so elements can be modified in place, and passed to any function/object expecting a standard mutable `set`.

    Underlying data structure is a `set`.

    """
    @overload
    def __new__(cls, data: Iterable[T], /) -> Self: ...
    @overload
    def __new__(cls, data: T, *more: T) -> Self: ...
    @overload
    def __new__(cls, /) -> Self: ...
    def __new__(cls, data: Iterable[T] | T = (), /, *more: T) -> Self:
        """Create a new `SetMut` instance.

        If no arguments are provided, an empty `SetMut` is created.

        Args:
            data (Iterable[T] | T): Initial elements to populate the set with. Defaults to `()`.
            *more (T): Additional elements to add to the set.

        Returns:
            Self: A new `SetMut` instance.

        Example:
            ```python
            from pyochain import SetMut

            data = (0, 1, 2, 3)

            # Create a `SetMut` from an iterable
            assert SetMut(data) == SetMut(range(0, 4)) == set(data)

            # Create a `SetMut` from a single, non-iterable element
            assert SetMut(1) == SetMut((1,)) == SetMut([1]) == set([1])

            # Create a `SetMut` from multiple elements
            assert SetMut(0, 1, 2, 3) == SetMut(data)

            # Create an empty `SetMut`
            assert SetMut() == SetMut([]) == SetMut(()) == set()
            assert repr(SetMut()) == "SetMut()"
            ```
        """

    @override
    def __iter__(self) -> Iterator[T]: ...
    @override
    def __len__(self) -> int: ...
    @override
    def __contains__(self, item: object) -> bool: ...
    @override
    def __eq__(self, other: object) -> bool: ...
    @override
    # pyrefly: ignore [bad-override]
    def __and__(self, value: AbstractSet[object], /) -> SetMut[T]:  # pyright: ignore[reportIncompatibleMethodOverride]
        """Return self&value."""

    @override
    def __iand__(self, value: AbstractSet[object], /) -> SetMut[T]:
        """Return self&=value."""

    @override
    # pyrefly: ignore [bad-override]
    def __or__[S](self, value: AbstractSet[S], /) -> SetMut[T | S]:  # pyright: ignore[reportIncompatibleMethodOverride]
        """Return self|value.

        Args:
            value (AbstractSet[S]): The set to perform the union with.

        Returns:
            SetMut[T | S]: A new `SetMut` instance containing the union of the two sets.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2, 3)
            s2 = SetMut(3, 4, 5)
            s3 = s1 | s2
            assert s3 == SetMut(1, 2, 3, 4, 5)
            ```
        """

    @override
    def __ior__(self, value: AbstractSet[T], /) -> SetMut[T]:
        """Return self|=value.

        Args:
            value (AbstractSet[T]): The set to perform the union with.

        Returns:
            SetMut[T]: The current instance after performing the union operation.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2, 3)
            s2 = SetMut(3, 4, 5)
            s1 |= s2
            assert s1 == SetMut(1, 2, 3, 4, 5)
            ```
        """

    @override
    # pyrefly: ignore [bad-override]
    def __sub__(self, value: AbstractSet[object], /) -> SetMut[T]:  # pyright: ignore[reportIncompatibleMethodOverride]
        """Return self-value.

        Args:
            value (AbstractSet[object]): The set to subtract.

        Returns:
            SetMut[T]: A new `SetMut` instance containing the result of the subtraction.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2, 3)
            s2 = SetMut(2, 3, 4)
            s3 = s1 - s2
            assert s3 == SetMut(1)
            ```
        """

    @override
    def __isub__(self, value: AbstractSet[object], /) -> SetMut[T]:
        """Return self-=value.

        Args:
            value (AbstractSet[object]): The set to subtract.

        Returns:
            SetMut[T]: The current instance after performing the subtraction operation.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2, 3)
            s2 = SetMut(2, 3, 4)
            s1 -= s2
            assert s1 == SetMut(1)
            ```
        """

    @override
    # pyrefly: ignore [bad-override]
    def __xor__[S](self, value: AbstractSet[S], /) -> SetMut[T | S]:  # pyright: ignore[reportIncompatibleMethodOverride]
        """Return self^value.

        Args:
            value (AbstractSet[S]): The set to perform the symmetric difference with.

        Returns:
            SetMut[T | S]: A new `SetMut` instance containing the result of the symmetric difference.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2, 3)
            s2 = SetMut(3, 4, 5)
            s3 = s1 ^ s2
            assert s3 == SetMut(1, 2, 4, 5)
            ```
        """

    @override
    def __ixor__(self, value: AbstractSet[T], /) -> SetMut[T]:
        """Return self^=value.

        Args:
            value (AbstractSet[T]): The set to perform the symmetric difference with.

        Returns:
            SetMut[T]: The current instance after performing the symmetric difference operation.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2, 3)
            s2 = SetMut(3, 4, 5)
            s1 ^= s2
            assert s1 == SetMut(1, 2, 4, 5)
            ```
        """

    @override
    def __le__(self, value: AbstractSet[object], /) -> bool:
        """Return self<=value.

        Args:
            value (AbstractSet[object]): The set to compare against.

        Returns:
            bool: `True` if self is a subset of value, `False` otherwise.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2)
            s2 = SetMut(1, 2, 3)
            assert s1 <= s2
            assert not s2 <= s1
            ```
        """

    @override
    def __lt__(self, value: AbstractSet[object], /) -> bool:
        """Return self<value.

        Args:
            value (AbstractSet[object]): The set to compare against.

        Returns:
            bool: `True` if self is a proper subset of value, `False` otherwise.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2)
            s2 = SetMut(1, 2, 3)
            assert s1 < s2
            assert not s2 < s1
            ```
        """

    @override
    def __ge__(self, value: AbstractSet[object], /) -> bool:
        """Return self>=value.

        Args:
            value (AbstractSet[object]): The set to compare against.

        Returns:
            bool: `True` if self is a superset of value, `False` otherwise.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2, 3)
            s2 = SetMut(1, 2)
            assert s1 >= s2
            assert not s2 >= s1
            ```
        """

    @override
    def __gt__(self, value: AbstractSet[object], /) -> bool:
        """Return self>value.

        Args:
            value (AbstractSet[object]): The set to compare against.

        Returns:
            bool: `True` if self is a proper superset of value, `False` otherwise.

        Example:
            ```python
            from pyochain import SetMut

            s1 = SetMut(1, 2, 3)
            s2 = SetMut(1, 2)
            assert s1 > s2
            assert not s2 > s1
            ```
        """

    @override
    @staticmethod
    def wrap[W](iterable: set[W]) -> SetMut[W]: ...  # pyright: ignore[reportIncompatibleMethodOverride]
    @override
    @staticmethod
    def from_iter[I](iterable: Iterable[I], /) -> SetMut[I]: ...
    @override
    @staticmethod
    def of[E](*args: E) -> SetMut[E]: ...
    @override
    def add(self, value: T) -> None:
        """Add an element to **self**.

        Args:
            value (T): The element to add.

        Example:
            ```python
            from pyochain import SetMut, Vec

            s = SetMut("a", "b")
            s.add("c")
            assert s.iter().sort() == Vec("a", "b", "c")
            ```
        """

    def copy(self) -> Self:
        """Create a shallow copy of the underlying `set`.

        Returns:
            Self: A shallow copy of the underlying `set`.

        Example:
            ```python
            from pyochain import SetMut

            s = SetMut("a", "b")
            s_copy = s.copy()
            s_copy.add("c")
            assert not "c" in s
            assert "c" in s_copy
            ```
        """

    @override
    def discard(self, value: T) -> None:
        """Remove an element from **self** if it is a member.

        Unlike [`SetMut::remove`][remove], this method does not raise an exception when an element is missing from the set.

        Args:
            value (T): The element to remove.

        Example:
            ```python
            from pyochain import SetMut, Vec

            s = SetMut("a", "b", "c")
            s.discard("b")
            assert s.iter().sort() == Vec("a", "c")
            ```
        """

    def intersection_update(self, *s: Iterable[object]) -> None:
        """Update the set, keeping only elements found in it and all others."""

    @override
    def isdisjoint(self, s: Iterable[object], /) -> bool:
        """Return True if two sets have a null intersection."""

    @override
    def is_subset(self, other: Iterable[object]) -> bool: ...
    @override
    def is_superset(self, other: Iterable[object]) -> bool: ...
    @override
    def remove(self, element: T, /) -> None:
        """Remove an element from a set; it must be a member.

        If the element is not a member, raise a KeyError.
        """

    def symmetric_difference_update(self, s: Iterable[T], /) -> None:
        """Update the set, keeping only elements found in either set, but not in both."""

    @override
    # pyrefly: ignore [bad-override]
    def intersection(self, *others: Iterable[object]) -> SetMut[T]:  # pyright: ignore[reportIncompatibleMethodOverride]
        ...
    @override
    # pyrefly: ignore [bad-override]
    def union[S](self, *others: Iterable[S]) -> SetMut[T | S]:  # pyright: ignore[reportIncompatibleMethodOverride]
        ...
    def update(self, *s: Iterable[T]) -> None:
        """Update the set, adding elements from all others."""

    @override
    # pyrefly: ignore [bad-override]
    def difference(self, *others: Iterable[object]) -> SetMut[T]:  # pyright: ignore[reportIncompatibleMethodOverride]
        ...
    def difference_update(self, *s: Iterable[object]) -> None:
        """Update the set, removing elements found in others."""

    @override
    def symmetric_difference[S](self, other: Iterable[S]) -> SetMut[T | S]: ...

__new__(data=(), /, *more)

__new__(data: Iterable[T]) -> Self
__new__(data: T, *more: T) -> Self
__new__() -> Self

Create a new SetMut instance.

If no arguments are provided, an empty SetMut is created.

Parameters:

Name Type Description Default
data Iterable[T] | T

Initial elements to populate the set with. Defaults to ().

()
*more T

Additional elements to add to the set.

()

Returns:

Name Type Description
Self Self

A new SetMut instance.

Example
from pyochain import SetMut

data = (0, 1, 2, 3)

# Create a `SetMut` from an iterable
assert SetMut(data) == SetMut(range(0, 4)) == set(data)

# Create a `SetMut` from a single, non-iterable element
assert SetMut(1) == SetMut((1,)) == SetMut([1]) == set([1])

# Create a `SetMut` from multiple elements
assert SetMut(0, 1, 2, 3) == SetMut(data)

# Create an empty `SetMut`
assert SetMut() == SetMut([]) == SetMut(()) == set()
assert repr(SetMut()) == "SetMut()"
Source code in pyochain/core/_set.pyi
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
def __new__(cls, data: Iterable[T] | T = (), /, *more: T) -> Self:
    """Create a new `SetMut` instance.

    If no arguments are provided, an empty `SetMut` is created.

    Args:
        data (Iterable[T] | T): Initial elements to populate the set with. Defaults to `()`.
        *more (T): Additional elements to add to the set.

    Returns:
        Self: A new `SetMut` instance.

    Example:
        ```python
        from pyochain import SetMut

        data = (0, 1, 2, 3)

        # Create a `SetMut` from an iterable
        assert SetMut(data) == SetMut(range(0, 4)) == set(data)

        # Create a `SetMut` from a single, non-iterable element
        assert SetMut(1) == SetMut((1,)) == SetMut([1]) == set([1])

        # Create a `SetMut` from multiple elements
        assert SetMut(0, 1, 2, 3) == SetMut(data)

        # Create an empty `SetMut`
        assert SetMut() == SetMut([]) == SetMut(()) == set()
        assert repr(SetMut()) == "SetMut()"
        ```
    """

__and__(value)

Return self&value.

Source code in pyochain/core/_set.pyi
341
342
343
344
@override
# pyrefly: ignore [bad-override]
def __and__(self, value: AbstractSet[object], /) -> SetMut[T]:  # pyright: ignore[reportIncompatibleMethodOverride]
    """Return self&value."""

__iand__(value)

Return self&=value.

Source code in pyochain/core/_set.pyi
346
347
348
@override
def __iand__(self, value: AbstractSet[object], /) -> SetMut[T]:
    """Return self&=value."""

__or__(value)

Return self|value.

Parameters:

Name Type Description Default
value Set[S]

The set to perform the union with.

required

Returns:

Type Description
SetMut[T | S]

SetMut[T | S]: A new SetMut instance containing the union of the two sets.

Example
from pyochain import SetMut

s1 = SetMut(1, 2, 3)
s2 = SetMut(3, 4, 5)
s3 = s1 | s2
assert s3 == SetMut(1, 2, 3, 4, 5)
Source code in pyochain/core/_set.pyi
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
@override
# pyrefly: ignore [bad-override]
def __or__[S](self, value: AbstractSet[S], /) -> SetMut[T | S]:  # pyright: ignore[reportIncompatibleMethodOverride]
    """Return self|value.

    Args:
        value (AbstractSet[S]): The set to perform the union with.

    Returns:
        SetMut[T | S]: A new `SetMut` instance containing the union of the two sets.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2, 3)
        s2 = SetMut(3, 4, 5)
        s3 = s1 | s2
        assert s3 == SetMut(1, 2, 3, 4, 5)
        ```
    """

__ior__(value)

Return self|=value.

Parameters:

Name Type Description Default
value Set[T]

The set to perform the union with.

required

Returns:

Type Description
SetMut[T]

SetMut[T]: The current instance after performing the union operation.

Example
from pyochain import SetMut

s1 = SetMut(1, 2, 3)
s2 = SetMut(3, 4, 5)
s1 |= s2
assert s1 == SetMut(1, 2, 3, 4, 5)
Source code in pyochain/core/_set.pyi
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
@override
def __ior__(self, value: AbstractSet[T], /) -> SetMut[T]:
    """Return self|=value.

    Args:
        value (AbstractSet[T]): The set to perform the union with.

    Returns:
        SetMut[T]: The current instance after performing the union operation.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2, 3)
        s2 = SetMut(3, 4, 5)
        s1 |= s2
        assert s1 == SetMut(1, 2, 3, 4, 5)
        ```
    """

__sub__(value)

Return self-value.

Parameters:

Name Type Description Default
value Set[object]

The set to subtract.

required

Returns:

Type Description
SetMut[T]

SetMut[T]: A new SetMut instance containing the result of the subtraction.

Example
from pyochain import SetMut

s1 = SetMut(1, 2, 3)
s2 = SetMut(2, 3, 4)
s3 = s1 - s2
assert s3 == SetMut(1)
Source code in pyochain/core/_set.pyi
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
@override
# pyrefly: ignore [bad-override]
def __sub__(self, value: AbstractSet[object], /) -> SetMut[T]:  # pyright: ignore[reportIncompatibleMethodOverride]
    """Return self-value.

    Args:
        value (AbstractSet[object]): The set to subtract.

    Returns:
        SetMut[T]: A new `SetMut` instance containing the result of the subtraction.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2, 3)
        s2 = SetMut(2, 3, 4)
        s3 = s1 - s2
        assert s3 == SetMut(1)
        ```
    """

__isub__(value)

Return self-=value.

Parameters:

Name Type Description Default
value Set[object]

The set to subtract.

required

Returns:

Type Description
SetMut[T]

SetMut[T]: The current instance after performing the subtraction operation.

Example
from pyochain import SetMut

s1 = SetMut(1, 2, 3)
s2 = SetMut(2, 3, 4)
s1 -= s2
assert s1 == SetMut(1)
Source code in pyochain/core/_set.pyi
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
@override
def __isub__(self, value: AbstractSet[object], /) -> SetMut[T]:
    """Return self-=value.

    Args:
        value (AbstractSet[object]): The set to subtract.

    Returns:
        SetMut[T]: The current instance after performing the subtraction operation.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2, 3)
        s2 = SetMut(2, 3, 4)
        s1 -= s2
        assert s1 == SetMut(1)
        ```
    """

__xor__(value)

Return self^value.

Parameters:

Name Type Description Default
value Set[S]

The set to perform the symmetric difference with.

required

Returns:

Type Description
SetMut[T | S]

SetMut[T | S]: A new SetMut instance containing the result of the symmetric difference.

Example
from pyochain import SetMut

s1 = SetMut(1, 2, 3)
s2 = SetMut(3, 4, 5)
s3 = s1 ^ s2
assert s3 == SetMut(1, 2, 4, 5)
Source code in pyochain/core/_set.pyi
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
@override
# pyrefly: ignore [bad-override]
def __xor__[S](self, value: AbstractSet[S], /) -> SetMut[T | S]:  # pyright: ignore[reportIncompatibleMethodOverride]
    """Return self^value.

    Args:
        value (AbstractSet[S]): The set to perform the symmetric difference with.

    Returns:
        SetMut[T | S]: A new `SetMut` instance containing the result of the symmetric difference.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2, 3)
        s2 = SetMut(3, 4, 5)
        s3 = s1 ^ s2
        assert s3 == SetMut(1, 2, 4, 5)
        ```
    """

__ixor__(value)

Return self^=value.

Parameters:

Name Type Description Default
value Set[T]

The set to perform the symmetric difference with.

required

Returns:

Type Description
SetMut[T]

SetMut[T]: The current instance after performing the symmetric difference operation.

Example
from pyochain import SetMut

s1 = SetMut(1, 2, 3)
s2 = SetMut(3, 4, 5)
s1 ^= s2
assert s1 == SetMut(1, 2, 4, 5)
Source code in pyochain/core/_set.pyi
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
@override
def __ixor__(self, value: AbstractSet[T], /) -> SetMut[T]:
    """Return self^=value.

    Args:
        value (AbstractSet[T]): The set to perform the symmetric difference with.

    Returns:
        SetMut[T]: The current instance after performing the symmetric difference operation.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2, 3)
        s2 = SetMut(3, 4, 5)
        s1 ^= s2
        assert s1 == SetMut(1, 2, 4, 5)
        ```
    """

__le__(value)

Return self<=value.

Parameters:

Name Type Description Default
value Set[object]

The set to compare against.

required

Returns:

Name Type Description
bool bool

True if self is a subset of value, False otherwise.

Example
from pyochain import SetMut

s1 = SetMut(1, 2)
s2 = SetMut(1, 2, 3)
assert s1 <= s2
assert not s2 <= s1
Source code in pyochain/core/_set.pyi
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
@override
def __le__(self, value: AbstractSet[object], /) -> bool:
    """Return self<=value.

    Args:
        value (AbstractSet[object]): The set to compare against.

    Returns:
        bool: `True` if self is a subset of value, `False` otherwise.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2)
        s2 = SetMut(1, 2, 3)
        assert s1 <= s2
        assert not s2 <= s1
        ```
    """

__lt__(value)

Return self<value.

Parameters:

Name Type Description Default
value Set[object]

The set to compare against.

required

Returns:

Name Type Description
bool bool

True if self is a proper subset of value, False otherwise.

Example
from pyochain import SetMut

s1 = SetMut(1, 2)
s2 = SetMut(1, 2, 3)
assert s1 < s2
assert not s2 < s1
Source code in pyochain/core/_set.pyi
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
@override
def __lt__(self, value: AbstractSet[object], /) -> bool:
    """Return self<value.

    Args:
        value (AbstractSet[object]): The set to compare against.

    Returns:
        bool: `True` if self is a proper subset of value, `False` otherwise.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2)
        s2 = SetMut(1, 2, 3)
        assert s1 < s2
        assert not s2 < s1
        ```
    """

__ge__(value)

Return self>=value.

Parameters:

Name Type Description Default
value Set[object]

The set to compare against.

required

Returns:

Name Type Description
bool bool

True if self is a superset of value, False otherwise.

Example
from pyochain import SetMut

s1 = SetMut(1, 2, 3)
s2 = SetMut(1, 2)
assert s1 >= s2
assert not s2 >= s1
Source code in pyochain/core/_set.pyi
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
@override
def __ge__(self, value: AbstractSet[object], /) -> bool:
    """Return self>=value.

    Args:
        value (AbstractSet[object]): The set to compare against.

    Returns:
        bool: `True` if self is a superset of value, `False` otherwise.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2, 3)
        s2 = SetMut(1, 2)
        assert s1 >= s2
        assert not s2 >= s1
        ```
    """

__gt__(value)

Return self>value.

Parameters:

Name Type Description Default
value Set[object]

The set to compare against.

required

Returns:

Name Type Description
bool bool

True if self is a proper superset of value, False otherwise.

Example
from pyochain import SetMut

s1 = SetMut(1, 2, 3)
s2 = SetMut(1, 2)
assert s1 > s2
assert not s2 > s1
Source code in pyochain/core/_set.pyi
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
@override
def __gt__(self, value: AbstractSet[object], /) -> bool:
    """Return self>value.

    Args:
        value (AbstractSet[object]): The set to compare against.

    Returns:
        bool: `True` if self is a proper superset of value, `False` otherwise.

    Example:
        ```python
        from pyochain import SetMut

        s1 = SetMut(1, 2, 3)
        s2 = SetMut(1, 2)
        assert s1 > s2
        assert not s2 > s1
        ```
    """

add(value)

Add an element to self.

Parameters:

Name Type Description Default
value T

The element to add.

required
Example
from pyochain import SetMut, Vec

s = SetMut("a", "b")
s.add("c")
assert s.iter().sort() == Vec("a", "b", "c")
Source code in pyochain/core/_set.pyi
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
@override
def add(self, value: T) -> None:
    """Add an element to **self**.

    Args:
        value (T): The element to add.

    Example:
        ```python
        from pyochain import SetMut, Vec

        s = SetMut("a", "b")
        s.add("c")
        assert s.iter().sort() == Vec("a", "b", "c")
        ```
    """

copy()

Create a shallow copy of the underlying set.

Returns:

Name Type Description
Self Self

A shallow copy of the underlying set.

Example
from pyochain import SetMut

s = SetMut("a", "b")
s_copy = s.copy()
s_copy.add("c")
assert not "c" in s
assert "c" in s_copy
Source code in pyochain/core/_set.pyi
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
def copy(self) -> Self:
    """Create a shallow copy of the underlying `set`.

    Returns:
        Self: A shallow copy of the underlying `set`.

    Example:
        ```python
        from pyochain import SetMut

        s = SetMut("a", "b")
        s_copy = s.copy()
        s_copy.add("c")
        assert not "c" in s
        assert "c" in s_copy
        ```
    """

discard(value)

Remove an element from self if it is a member.

Unlike SetMut::remove, this method does not raise an exception when an element is missing from the set.

Parameters:

Name Type Description Default
value T

The element to remove.

required
Example
from pyochain import SetMut, Vec

s = SetMut("a", "b", "c")
s.discard("b")
assert s.iter().sort() == Vec("a", "c")
Source code in pyochain/core/_set.pyi
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
@override
def discard(self, value: T) -> None:
    """Remove an element from **self** if it is a member.

    Unlike [`SetMut::remove`][remove], this method does not raise an exception when an element is missing from the set.

    Args:
        value (T): The element to remove.

    Example:
        ```python
        from pyochain import SetMut, Vec

        s = SetMut("a", "b", "c")
        s.discard("b")
        assert s.iter().sort() == Vec("a", "c")
        ```
    """

intersection_update(*s)

Update the set, keeping only elements found in it and all others.

Source code in pyochain/core/_set.pyi
626
627
def intersection_update(self, *s: Iterable[object]) -> None:
    """Update the set, keeping only elements found in it and all others."""

isdisjoint(s)

Return True if two sets have a null intersection.

Source code in pyochain/core/_set.pyi
629
630
631
@override
def isdisjoint(self, s: Iterable[object], /) -> bool:
    """Return True if two sets have a null intersection."""

remove(element)

Remove an element from a set; it must be a member.

If the element is not a member, raise a KeyError.

Source code in pyochain/core/_set.pyi
637
638
639
640
641
642
@override
def remove(self, element: T, /) -> None:
    """Remove an element from a set; it must be a member.

    If the element is not a member, raise a KeyError.
    """

symmetric_difference_update(s)

Update the set, keeping only elements found in either set, but not in both.

Source code in pyochain/core/_set.pyi
644
645
def symmetric_difference_update(self, s: Iterable[T], /) -> None:
    """Update the set, keeping only elements found in either set, but not in both."""

update(*s)

Update the set, adding elements from all others.

Source code in pyochain/core/_set.pyi
655
656
def update(self, *s: Iterable[T]) -> None:
    """Update the set, adding elements from all others."""

difference_update(*s)

Update the set, removing elements found in others.

Source code in pyochain/core/_set.pyi
662
663
def difference_update(self, *s: Iterable[object]) -> None:
    """Update the set, removing elements found in others."""