bpo-34552: Clarify built-in types comparisons#9035
Conversation
auvipy
left a comment
There was a problem hiding this comment.
please check the build failures and try to fix them
fb64376 to
42a27a9
Compare
|
@auvipy I fixed the failures. I think we should add skip news label in this pr |
There was a problem hiding this comment.
Why did you add "should"? This is a descriptive section (explaining how builtin objects work) not a prescription for how one should implement objects in general.
There was a problem hiding this comment.
Yes, you are right.
There was a problem hiding this comment.
Suggestion:
The
==operator is always defined but for some object types is equivalent to :keyword:is.
There was a problem hiding this comment.
How about
The
==operator is always defined but for some object types (for example, function objects) is equivalent to :keyword:is.
There was a problem hiding this comment.
I'd use class objects instead of function objects -- the intro to this section (L15) mentions those explicitly.
FWIW reading that section makes me think we should replace compared on L23 with compared for equality.
There was a problem hiding this comment.
Suggestion:
The
<=,>and>=operators are only defined where they make sense; for example, they raise a
:exc:TypeErrorexception when one of the arguments is a complex number.
There was a problem hiding this comment.
Should we talk about != operator here? I'm not sure is != always defined just like ==.
There was a problem hiding this comment.
In new enough 3.x versions, if you define __eq__ but leave __ne__ undefined, != falls back to not ==. I don't think it's worth mentioning, since this is not the language reference, just a brief summary of typical behavior of common objects.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
42a27a9 to
17bd781
Compare
17bd781 to
4a12731
Compare
|
Can you add a news blurb? That will clear the bedevere/news test failure. Also please don't amend your local commit and |
Thank you for point it out. |
|
@Windsooon DO you have time to push a new version reflecting the latest discussion? |
|
@gvanrossum I do have time, I added the blurb, but I'm not sure what should I do next? |
|
Ah, sorry. I'm not sure what happened -- maybe you amended your commit, maybe I didn't re-check the latest version. I am now happy and will let the bot do the rest. |
Some updates to ancient text about comparisons; fixes bp-34552.