-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-122450: Indicate that Fraction
denominators are always positive
#136789
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
Merged
+2
−2
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Sorry, I don't think it's an improvement.
Old sentence is clear: we return a rational number with value numerator/denominator.
But original numerator and denominator may have any sign, may be not integers, etc.
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.
I agree with @skirpichev. We can leave "equals", but "where the denominator is positive" is incorrect or at least ambiguous. "Denominator" refers to the argument of the
Fraction
constructor, not thedenominator
property.Uh oh!
There was an error while loading. Please reload this page.
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.
I also agree. It's as if we require denomintor to be positive (as an argument) which is not the case. So I suggest to revert this PR.
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.
I opened pr to fix docstrings in Rational class: #136800 It's a accompanying pr to #122464, which fix sphinx docs (and stuck in review).
But maybe it's ok to combine both and include reversion of this pr? All that only affects docs and IMO - fine for backporting up to 3.13.
What do you think?
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.
@serhiy-storchaka @skirpichev we discussed this at the sprint and decided that
*denominator*
(italics) referred to the argument, butdenominator
(normal/roman) in the context of the sentence referred to the new argument. Regardless, it simplifies the arguments, so it is not always thedenominator
argument that is set as the class attribute.A
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.
It says: "a new :class:
Fraction
instance with value equal tonumerator/denominator
". "denominator" refers to argument, not to the property. Otherwise this sentence does not make sense. Then you say that in "where the denominator is positive" "denominator" refers to something other. But it clearly refers to the same thing as in previous expression. Your interpretation requires interpreting the same word in two different ways simultaneously. Even if it makes sense, it is very unclear and confusing. And to me, it just looks wrong.