ior
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user