Skip to content

Commit

Permalink
improve performance of StaticPartitionsDefinition.__eq__ (#11775)
Browse files Browse the repository at this point in the history
### Summary & Motivation

### How I Tested These Changes
  • Loading branch information
sryza committed Jan 18, 2023
1 parent a54d170 commit 8e7ea32
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions python_modules/dagster/dagster/_core/definitions/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,8 @@ def __hash__(self):
return hash(self.__repr__())

def __eq__(self, other) -> bool:
return (
isinstance(other, StaticPartitionsDefinition)
and self._partitions == other.get_partitions()
return isinstance(other, StaticPartitionsDefinition) and (
self is other or self._partitions == other.get_partitions()
)

def __repr__(self) -> str:
Expand Down

0 comments on commit 8e7ea32

Please sign in to comment.