Skip to content

Commit

Permalink
Use 'is' for exact type comparisons.
Browse files Browse the repository at this point in the history
  • Loading branch information
ast0815 committed Nov 22, 2023
1 parent 443d301 commit 543c4ef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/remu/binning.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def __contains__(self, event):

def __eq__(self, other):
"""Bins are equal if they are of the same type, defined on the same phase space."""
return type(self) == type(other) and self.phasespace == other.phasespace
return type(self) is type(other) and self.phasespace == other.phasespace

def __ne__(self, other):
return not self == other
Expand Down Expand Up @@ -2242,7 +2242,7 @@ def project(self, binning_i, **kwargs):
def __eq__(self, other):
"""CartesianProductBinnings are equal if the included Binnings match."""
return (
type(self) == type(other)
type(self) is type(other)
and self.binnings == other.binnings
and self.subbinnings == other.subbinnings
)
Expand Down Expand Up @@ -2527,7 +2527,7 @@ def _get_clone_kwargs(self, **kwargs):
def __eq__(self, other):
"""Linear binnings are equal if the variable and edges match."""
return (
type(self) == type(other)
type(self) is type(other)
and self.variable == other.variable
and np.all(self.bin_edges == other.bin_edges)
and self.include_upper == other.include_upper
Expand Down Expand Up @@ -2876,7 +2876,7 @@ def remove_bin_edges(self, bin_edge_indices):
def __eq__(self, other):
"""RectilinearBinnings are equal if the bin edges and variables match."""
return (
type(self) == type(other)
type(self) is type(other)
and self.variables == other.variables
and all(
tuple(
Expand Down

0 comments on commit 543c4ef

Please sign in to comment.