Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cdict/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ def apply_fn(x: Any) -> Any:
def __add__(self, other: cdict_base) -> cdict_base:
return cdict_iter([self, other])

def __sub__(self, other: cdict_base) -> cdict_base:
def hashify(x: dict) -> tuple:
return tuple(sorted(x.items()))

other_set = set((hashify(x) for x in other))
return self.filter(lambda x: hashify(x) not in other_set)

def __mul__(self, other: cdict_base) -> cdict_base:
if not isinstance(other, cdict_base):
return NotImplemented
Expand Down