You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The __eq__ method of Unit attempts to convert any value it is compared with to a Unit. The problem is when this fails it should return NotImplemented (or raise NotImplementedError) instead of raising ValueError. Because of this, comparisons such as:
when it should return False. By returning NotImplemented you can punt the decision to the other object or fall back on object identity (if neither object can handle the comparison).
The text was updated successfully, but these errors were encountered:
The
__eq__
method ofUnit
attempts to convert any value it is compared with to aUnit
. The problem is when this fails it should returnNotImplemented
(or raiseNotImplementedError
) instead of raisingValueError
. Because of this, comparisons such as:raises
when it should return
False
. By returningNotImplemented
you can punt the decision to the other object or fall back on object identity (if neither object can handle the comparison).The text was updated successfully, but these errors were encountered: