-
Notifications
You must be signed in to change notification settings - Fork 3
Quantity: constructing quantities #7
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
I don't think we want to force the init signature. Stuff like
IMO something like this sounds very reasonable. I think the ArrayAPI does this instead of option 1 for similar reasons as mentioned above.
If we want |
I'd rather have type flexibility on the
Why not mandate that
I don't see why not. |
Would this be a single namespace to cover Quantity, Unit, Dimension etc? |
Why not emulate the Array API and have a constructor function as the API and leave the class constructor up to the libraries? |
Ah! That's a thorny problem. My initial reaction was to say yes. But then an obvious counter-example arose: if someone makes a
But maybe that's not such a problem... |
IMO that's not a use case we should be considering. The dataframe API has a namespace with dataframe and column so there's precedent for them being under the same namespace |
Agreed. Packaging them together is a solveable problem. And there are ways to even make it statically compatible by a custom Protocol object for the use case demonstrated above.
Strong disagree 😄
I could probably think of more examples. Wrapping quantities and / or their units is not uncommon. As reference, the Array API is not just about vendoring Array classes, but also about making it easy to wrap an array object and have it act like the underlying array. Same here. It should be considered. Thankfully I think we agree there's probably a workable solution. |
Ahh I misunderstood. Yes that's important. Yea we should be able to do similar to the array API |
How must we be able to construct a
Quantity
?Quantity(value, unit)
returnQ
such thatQ.value
isvalue
, andQ.unit
isunit
? If so, can we type that without enforcing certain signatures or parameter names which may be difficult for existing libraries to adopt?QuantityNamespace
, of which theQuantity
class is a member, but which also has a creation function such asQuantityNamespace.asquantity
? Would all existing libraries be happy with exposing such a namespace?value << unit
?The text was updated successfully, but these errors were encountered: