Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gh-116647: fix improve code style
  • Loading branch information
Ethan committed Mar 19, 2024
commit 5bdd01035508880050d5c26a5f5f3c61e7cb3ef9
2 changes: 1 addition & 1 deletion Lib/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen,
cmp_fields = (field for field in field_list if field.compare)
terms = [f'self.{field.name}==other.{field.name}' for field in cmp_fields]
field_comparisons = ' and '.join(terms) or 'True'
body = [f'if id(self) == id(other):',
body = [f'if self is other:',
f' return True',
f'if other.__class__ is self.__class__:',
f' return {field_comparisons}',
Expand Down