diff --git a/chempy/chemistry.py b/chempy/chemistry.py index f20f75bb..85685827 100644 --- a/chempy/chemistry.py +++ b/chempy/chemistry.py @@ -98,6 +98,17 @@ def __eq__(self, other): return False return True + def __hash__(self) -> int: + return sum( + map( + hash, + ( + getattr(self, k) + for k in self.attrs + ), + ) + ) + @property def charge(self): """Convenience property for accessing ``composition[0]``"""