[Python-Dev] Comparison corner case (original) (raw)
Tim Peters tim@digicool.com
Tue, 15 May 2001 16:22:37 -0400
- Previous message: [Python-Dev] FYI: MIT's dynamic language design panel now online
- Next message: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.48,2.49
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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. """
- Previous message: [Python-Dev] FYI: MIT's dynamic language design panel now online
- Next message: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.48,2.49
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]