-
Notifications
You must be signed in to change notification settings - Fork 17
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
Allow all quantities division by float | Self
#876
Conversation
Based on: |
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.
See comments
Isn't this a paradox? |
Thanks for the review, I will update once #875 is merged. |
4ba665c
to
656f88b
Compare
Rebased and marked the PR ready for review. You comments should be already addressed. |
Enabling auto-merge as this had a previous review already. |
656f88b
to
58ae589
Compare
float | Percentage | Self
float | Self
Updated to remove division by |
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.
There are a few occurances of "percentage" in docstrings that need to be removed, but looks good otherwise.
58ae589
to
375d71d
Compare
Dividing by `float` is only applying a factor so it should be safe for any `Quantity`. Dividing by `Self` produces a unit-less ration (`float`), so it should be safe too. To be able to use nicer names in overloads, we use positional-only arguments for `__truediv__()`, which in practice shouldn't be much of a breaking change as these methods should be used mostly via operators. We also use `match` syntax in the changed methods. Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
375d71d
to
15ac8c8
Compare
Updated to hopefully remove all the remaining mentions to percentage and rebased. |
ping @shsms |
Dividing by
float
is only applying a factor so it should be safe for anyQuantity
.Dividing by
Self
produces a unit-less ration (float
), so it should be safe too.To be able to use nicer names in overloads, we use positional-only arguments for
__truediv__()
, which in practice shouldn't be much of a breaking change as these methods should be used mostly via operators.We also use
match
syntax in the changed methods.