def __eq__(self, other): """Return ``self == other``. Returns ------- equals : bool ``True`` if ``other`` is a `DiscretizedSet` instance and all attributes `uspace`, `dspace`, `DiscretizedSet.sampling` and `DiscretizedSet.interpolation` of ``other`` and this discretization are equal, ``False`` otherwise. """ # Optimizations for simple cases if other is self: return True elif other is None: return False else: return (NtuplesBase.__eq__(self, other) and other.uspace == self.uspace and other.dspace == self.dspace and other.sampling == self.sampling and other.interpolation == self.interpolation)
def __hash__(self): """Return ``hash(self)``.""" return hash((NtuplesBase.__hash__(self), self.uspace, self.dspace, self.__sampling, self.__interpolation))