This commit is contained in:
John Lancaster
2026-02-21 00:01:35 -06:00
parent a502381c1a
commit bfdd295ac5

View File

@@ -56,16 +56,26 @@ class DAGSet(MutableSet[T]):
# --- in-place operator support --- # --- in-place operator support ---
# def __ior__(self, other: Iterable[T]) -> DAGSet[T]: def __iadd__(self, other: Iterable[T]) -> DAGSet[T]:
# # a |= b => add everything in other # a += b => update/extend
# return self match other:
case set():
# def __iadd__(self, other: Iterable[T]) -> DAGSet[T]: self |= other
# # a += b => update/extend case str():
# return self self |= {other}
case Iterable():
self |= set(other)
case _:
self |= {other}
return self
# def __isub__(self, other: Iterable[T]) -> DAGSet[T]: # def __isub__(self, other: Iterable[T]) -> DAGSet[T]:
# # a -= b => remove those in other # # a -= b => remove those in other
# match other:
# case set():
# self -= other
# case _:
# self -= set(other)
# return self # return self
# def __iand__(self, other: Iterable[T]) -> DAGSet[T]: # def __iand__(self, other: Iterable[T]) -> DAGSet[T]: