diff --git a/src/daglib/set.py b/src/daglib/set.py index 3c13180..a306a1c 100644 --- a/src/daglib/set.py +++ b/src/daglib/set.py @@ -57,6 +57,17 @@ class DAGSet(MutableSet[T]): # --- in-place operator support --- + def __ior__(self, other: Iterable[T]) -> DAGSet[T]: + # a |= b => union update + match other: + case str(): + other = {other} + case Iterable(): + other = set(other) + case _: + other = {other} + return super().__ior__(other) + def __iadd__(self, other: Iterable[T]) -> DAGSet[T]: # a += b => update/extend match other: