July 26, 2019
9:52 a.m.
On Wed, Jul 24, 2019 at 08:25:31PM -0400, David Mertz wrote:
Exactly! that was my thought that the exception message could hint at likely approaches. The NumPy example seems to have a good pattern:
arr1 == arr2
ValueError: The truth value of an array with more than one element is ambiguous.
That's not actually what numpy does: py> numpy.array([1, 2]) == numpy.array([1, 2]) array([ True, True], dtype=bool) In any case, we should not allow numpy's (mis)feature into builtins. It might (perhaps...) be okay for third-party objects to break the law of excluded middle, and implement de-facto multi-valued logic (where an exception == Maybe), but we shouldn't have builtins do that. -- Steven