[Python-Dev] cmp(x,x) (original) (raw)
Gustavo Niemeyer niemeyer at conectiva.com
Tue May 25 12:50:14 EDT 2004
- Previous message: [Python-Dev] cmp(x,x)
- Next message: [Python-Dev] cmp(x,x)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> I'm not suggesting to limit 'a==a' to return True/False only. I'm > suggesting to introduce a shortcut in the list comparison (more > specifically, in listrichcompare), since this is what is > currently being done, but with a more expensive logic.
What does "currently" mean to you? 2.3.3 and HEAD differ here.
I meant HEAD.
> Going through the function, in a case where v is w and op is > either PyEQ or PyNE, we have
These cases aren't interesting on HEAD. Nobody calls listrichcompare directly. If something calls PyObjectRichCompareBool() with PyEQ or PyNE, then on HEAD the result is returned instantly, because of this code at the start of PyObjectRichCompareBool():
I'm wondering what is causing this confusion then:
% ./python Python 2.4a0 (#5, May 25 2004, 13:45:26) [GCC 3.3.3 (release)] on linux2 Type "help", "copyright", "credits" or "license" for more information. [...]
l = [] l == l Got in list_richcompare()! True if l == l: print "foo" ... Got in list_richcompare()! foo
-- Gustavo Niemeyer http://niemeyer.net
- Previous message: [Python-Dev] cmp(x,x)
- Next message: [Python-Dev] cmp(x,x)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]