[Python-Dev] Re: Comparing dict.values()

2019年7月26日 05:18:48 -0700

Steven D'Aprano wrote:
Equality tests really ought not to fail. If they do fail, it should be considered a bug in the __eq__ method, not an intentional result.
> To allow == tests to fail is just a way of sneaking in a three-value
> logic into the language, only using an extremely inconvenient API:
In the case being considered here, I would argue that attempting
to compare dict.values() results is a symptom of a bug in the
code performing that comparison, or at least a smell suggesting
that the programmer hasn't thought something through properly.
The remedy is to re-write that code to be explicit about what
is really wanted. There is no three-valued logic involved here.
--
Greg
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/FP52QVMJIB6O4DJMZV2NLWC4WIKELRRY/

Reply via email to