-
Notifications
You must be signed in to change notification settings - Fork 2
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
Quantity: add dunder methods #8
base: main
Are you sure you want to change the base?
Conversation
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've added some tentative suggestions but I'm not sure that they are correct — @jorenham do my suggestions look closer to what we would want here?
I feel like we need to get a type checker going to know what works and doesnt |
Yes, but we then also need |
does it have to be minimal? would a fork of pint (or another module) work? |
yeah, I think so! |
My mental typechecker did not report any errors 👌🏻 |
Exactly; writing annotations without a type-checker is like programming without a compiler or interpreter |
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
def __gt__[B](self: "Quantity[V, U]", other: "Quantity[op.CanOrd[V, B], U]", /) -> B: ... | ||
def __ge__[B](self: "Quantity[V, U]", other: "Quantity[op.CanOrd[V, B], U]", /) -> B: ... | ||
|
||
def __pos__[R](self: "Quantity[op.CanPos[R], U]") -> "Quantity[R, U]": ... |
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.
When would R in __pos__
ever not be V? I can't think of any examples. 🧐
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.
>>> +True
1
transferred from quantity-dev/quantity-api#6