docs: fix PLR0124 description to acknowledge __eq__ can be overridden#24717
Closed
avasis-ai wants to merge 1 commit intoastral-sh:mainfrom
Closed
docs: fix PLR0124 description to acknowledge __eq__ can be overridden#24717avasis-ai wants to merge 1 commit intoastral-sh:mainfrom
avasis-ai wants to merge 1 commit intoastral-sh:mainfrom
Conversation
ntBre
requested changes
Apr 20, 2026
Comment on lines
+15
to
+16
| /// Comparing a name to itself is likely a mistake, as `__eq__` may be | ||
| /// overridden to return a non-trivial value. |
Contributor
There was a problem hiding this comment.
I don't think this is quite the change we were picturing. This phrasing suggests that __eq__ returning an unusual value causes the issue, but the opposite is true. The lint rule applies except when you've overriden __eq__ to return something weird.
Contributor
Author
|
You're right, my previous phrasing was backwards. Updated to match the issue author's suggestion: |
Contributor
Author
|
Closing in favor of updated fix on a clean branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the documentation for
comparison-with-itself(PLR0124) to acknowledge that__eq__may be overridden to return a non-trivial value, making self-comparisons not always redundant.The previous wording stated that "Comparing a name to itself always results in the same value", which is incorrect when
__eq__is overridden.Closes #22160
Test Plan
Documentation-only change. The rule logic is unchanged.