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
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/SSIGTWGWCTLPMTKNPS3ADZ7HBV34NTD5/

Reply via email to