[Python-Dev] cmp(x,x) (original) (raw)
Tim Peters tim.one at comcast.net
Tue May 25 13:28:52 EDT 2004
- Previous message: [Python-Dev] cmp(x,x)
- Next message: [Python-Dev] Re: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.228, 1.229
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Gustavo Niemeyer]
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 listrichcompare()! True >>> if l == l: print "foo" ... Got in listrichcompare()! foo
My mistake! And my apologies. PyObject_RichCompare() (not ...Bool()) gets called in this case, and it can't infer anything from object identity alone. The list object may, but it's quite possible that trying to would cost more cycles than it saved.
- Previous message: [Python-Dev] cmp(x,x)
- Next message: [Python-Dev] Re: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.228, 1.229
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]