Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

initial Unit protocol #1

Closed
wants to merge 5 commits into from
Closed

Conversation

lucascolley
Copy link
Member

No description provided.

Comment on lines 20 to 21
# debatable whether this should be standardised
def __rlshift__[V](self, other: V) -> Quantity[V, Self]: ...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little lost as to the benefit of <<. In both those cases you can use u.Quantity(q, unit) and it does the same thing (maybe with copy=False), but for a new user seeing Quantity() is much clearer. With <<, I must find how what the << operator is (many users won't have used it before), realise astropy's made a custom implementation for it and find the docs for it. Is this worth it to save a few characters? I'm unsure.

from astropy/quantity-2.0#23 (comment), there was no futher discussion in that thread.

I haven't seen a compelling reason to standardise it.

@property
def dimension(self) -> Dimension: ...

def __mul__(self, other: Self, /) -> Self: ...
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need the reflected operators, right?

andrewgsavage and others added 2 commits March 9, 2025 22:12
Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
* add reverse ops

* remove rlshift

* Update src/unit_api/__init__.py

---------

Co-authored-by: Lucas Colley <lucas.colley8@gmail.com>
@lucascolley
Copy link
Member Author

incorporated into https://github.com/quantity-dev/metrology-apis

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants