-
Notifications
You must be signed in to change notification settings - Fork 3
Unit conversion #6
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
Comments
IMO we should have something, even if it's just a convenience method that does
for 3 reasons.
|
I'm not sure how strong of an argument this is. Are we really worried about false positives if the Quantity protocol is restricted to just "has
indeed. I'm much more convinced by this argument 😄
|
@neutrinoceros Are you suggesting return quantity_constructor(maybe_copy(value, copy), maybe_copy(unit, copy)) |
That's how I'm reading it, analagous to np.astype with units isntead of dtype. Assuming we have a conversion method, an inplace operator seems reasonable. pint uses I'm not sure on the converion method name, |
That's how I'm reading it as well, except that I don't think this is analogous to @neutrinoceros I am against putting easily accessible in-place mutations in the common API for the following reasons:
q = Quantity[Array[int], Unit](..., unit="lyr")
q.in_place_unit_conversion(unit="pc") # dtype is now float! IMO a method |
Sorry for the late reply, but yes, this is what I was suggesting. |
Personally, I prefer to start with the absolute minimum. Just like the Array API does not have Anyway, as said, I'd prefer to do the truly required stuff first - which arguably means to look better at the units API, and how what kind of converters we expect to be needed. |
Fair enough. We should document somewhere the list of things to return to 😆 . |
do we want unit conversion available via the Quantity API? Or is it sufficient to have a combination of unit conversion in the Unit API and quantity construction (somewhere—#7)?
Discussion of typing this at quantity-dev/quantity-api#1 (comment).
The text was updated successfully, but these errors were encountered: