astropy/astropy — pull request #2328 by mhvk (2014-04-16 03:35:37+00:00)
Title: Remove Quantity.__eq__, __ne__ so that == and != always return True, False

Currently, `q1==q2` and `q1!=q2` raise `UnitsError` if the units do not match. This, however, would seem overly protective of the user, and inconsistent with python usage elsewhere, where `==` always returns `False` is objects are incompatible. Simply removing the `__eq__` and `__ne__` from `Quantity`, and thus letting `ndarray` take care, solves this.

As a byproduct, one now gets the same result for `unit == (1.*unit)` and `(1.*unit) == unit`, since `Quantity` returns `NotImplemented` and `Unit` decides that it can turn the quantity into a unit (arguably, it shouldn't, but that is a problem for `Unit`, and at least it should be symmetric!).