Skip to content

Commit

Permalink
Declare Variable to be unhashable
Browse files Browse the repository at this point in the history
The appropriate place to do this seems to be beside the definition
of `__eq__` since defining `__eq__` without `__hash__` renders an
object unhashable.

For a reference to how types are marked as non-hashable, see
<https://github.com/python/typeshed/pull/3219/files>
  • Loading branch information
maresb committed Oct 29, 2023
1 parent f63ede9 commit 7111be1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xarray/core/_typed_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ def __eq__(self, other: VarCompatible) -> Self:
def __eq__(self, other: VarCompatible) -> Self | T_DataArray:
return self._binary_op(other, nputils.array_eq)

__hash__: None # type:ignore[assignment]

@overload # type:ignore[override]
def __ne__(self, other: T_DataArray) -> T_DataArray:
...
Expand Down

0 comments on commit 7111be1

Please sign in to comment.