Skip to content

Commit

Permalink
override equal for derived predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
francescofuggitti committed Jun 1, 2023
1 parent ad68c05 commit 173de51
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pddl/logic/predicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ def __repr__(self) -> str:
"""Get the string representation."""
return f"{type(self).__name__}({self.predicate}, {self.condition})"

def __eq__(self, other):
"""Override equal operator."""
return (
isinstance(other, DerivedPredicate)
and self.predicate == other.predicate
and self.condition == other.condition
)

def __lt__(self, other):
"""Compare with another object."""
if isinstance(other, DerivedPredicate):
Expand Down

0 comments on commit 173de51

Please sign in to comment.