We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently, we use
def get_value_and_unit(arg, default_unit=None): try: unit = arg.unit except AttributeError: return arg, default_unit else: return arg.value, unit
which, if a protocol existed, would be as simple as
def get_value_and_unit(arg, default_unit=None): return (arg.value, arg.unit) if isinstance(arg, QuantityAPI) else (arg, default_unit)
The question is what exactly the protocol should be. E.g., from https://github.com/astropy/quantity-2.0/pull/2/files#r1858839304
@runtime_checkable class QuantityAPI(Protocol): value: Array unit: Unit
But perhaps this needs more discussion with other units package maintainers?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently, we use
which, if a protocol existed, would be as simple as
The question is what exactly the protocol should be. E.g., from https://github.com/astropy/quantity-2.0/pull/2/files#r1858839304
But perhaps this needs more discussion with other units package maintainers?
The text was updated successfully, but these errors were encountered: