Skip to content

Unit comparisons? #1692

Answered by hgrecco
quantumtrope asked this question in Q&A
Jan 4, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Comparing units from different registries is not well-defined, and therefore it is an invalid operation. You should not expect a valid result. We rely on Python's consenting adults philosophy.

If you are interested in the details, to avoid a performance hit Quantity._eq__ compares q2._units == q1._units, not q2.units == q1.units

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@quantumtrope
Comment options

Answer selected by quantumtrope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants