A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-May/014809.html below:

[Python-Dev] Comparison corner case

[Python-Dev] Comparison corner caseTim Peters tim@digicool.com
Tue, 15 May 2001 16:22:37 -0400
Here from the tail end of a patch comment.  If you believe the illustrated
behavior is wrong, then I don't believe we gain anything from using the
tp_richcmp slot for tuples for anything other than EQ/NE testing (the gain
for the latter is that it allows EQ/NE tuple comparison to work correctly on
tuples containing elements that support only EQ/NE comparisons):

"""
BUG ALERT:  The tuple (and list) richcmp algorithm is arguably wrong,
because it won't believe there's any difference unless Py_EQ returns false
for some corresponding elements:

>>> class C:
...     def __lt__(x, y): return 1
...     __eq__ = __lt__
...
>>> C() < C()
1
>>> (C(),) < (C(),)
0
>>>

That doesn't make sense -- provided you believe the defn. of C makes sense.
"""




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