[Python-Dev] Comparison speed

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Tue, 15 May 2001 00:06:57 +0200


> Anybody care to take a stab at making the new richcmp and/or coerce
> code ugly again?

When stepping through the code, I also missed support for the
relationship between identity and equality. E.g. in
PyObject_RichCompare, I'd expect

  if (v == w) {
     switch (op)
     case Py_EQ:case Py_LE:case Py_GE:
        Py_INCREF(Py_True);
        return Py_True;
     case Py_NE:case Py_LT:case Py_GT:
        Py_INCREF(Py_False);
        return Py_False;
     }
  }

That would not help in your case, of course. I don't even know how
frequent comparing identical objects is in real life - but this is
something that PyObject_Compare has that PyObject_RichCompare
currently doesn't.

Regards,
Martin