Stefan Krah <stefan-usenet <at> bytereef.org> writes: > > >>> d = {0:Decimal("NaN")} > >>> Decimal("NaN") in d.values() > False > > So, since non-decimal use cases are limited at best, the equality/inequality > operators might as well have the behavior of the other comparison operators, > which is safer for the user. The problem is when searching for /another/ object which hashes the same as Decimal("NaN"). Here is a made-up situation to show you the problem: >>> class H(object): ... def __hash__(self): return hash(1) ... def __eq__(self, other): raise ValueError ... >>> h = H() >>> d = {h: ""} >>> d[1] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in __eq__ ValueError >>> d[1] = 2 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in __eq__ ValueError
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4