◐ Shell
clean mode source ↗

Change comparison of Quantity (to fix gh-146) by bjodah · Pull Request #147 · python-quantities/python-quantities

I just ran the test suite for the Neo core module with this branch, and got

Ran 639 tests in 6.334s

FAILED (errors=35, failures=9)

so I think we can conclude this will indeed break a lot of things.

I do think this is something we should move towards, but we need to move slowly to avoid breaking downstream code unexpectedly. I suggest adding a global flag, e.g. QUANTITY_EQUALS_ARRAY which we would set to True by default. If True, then such comparisons will raise DeprecationWarning, if False they will raise ValueError as in this PR.

In six months or so we can set the global flag to False by default, so that people can still get the old behaviour if they prefer.

What do you think?