-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-37648: Fixed minor inconsistency in some __contains__. #14904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The collection's item is now always at the left and the needle is on the right of ==.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to assess if this PR changed the output of list.__contains__()
and tuple.__contains__()
(particularly in cases where the __eq__()
is incorrectly implemented, as mentioned in the issue), I performed the following comparison between cpython master and the PR branch:
This was by no means a thorough assessment of the changes, but I figured it might be useful to perform a basic comparison on two variables where (a == b) != (b == a)
for list.__contains__()
and tuple.__contains__()
.
I approve of this PR because it provides a higher degree of consistency with the positioning of the needle, and from my understanding, there's no functional disadvantage from implementing this change. Though, I'm not certain if there's any specific cases where the change results in a difference of output in the specific case of __contains__()
for list and tuple. Let me know if there are any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed a couple of trivial typos in the news entry:
Misc/NEWS.d/next/Core and Builtins/2019-07-22-11-05-05.bpo-37648.6TY2L-.rst
Outdated
Show resolved
Hide resolved
Misc/NEWS.d/next/Core and Builtins/2019-07-22-11-05-05.bpo-37648.6TY2L-.rst
Outdated
Show resolved
Hide resolved
…14904) The collection's item is now always at the left and the needle is on the right of ==.
…14904) The collection's item is now always at the left and the needle is on the right of ==.
…14904) The collection's item is now always at the left and the needle is on the right of ==.
The collection's item is now always at the left and
the needle is on the right of ==.
https://bugs.python.org/issue37648