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/2002-June/025303.html below:

[Python-Dev] Rich Comparison from "C" API?

[Python-Dev] Rich Comparison from "C" API? [Python-Dev] Rich Comparison from "C" API?David Abrahams David Abrahams" <david.abrahams@rcn.com
Wed, 12 Jun 2002 11:48:27 -0400
From: "Tim Peters" <tim.one@comcast.net>

> 1. You really want PyObject_RichCompareBool in your example, not
>    PyObject_RichCompare.  The former is much more efficient in some
>    cases (e.g., a total ordering on dicts is much hairer to determine
>    than just equality).

Now you're really pulling my leg. PyObject_RichCompareBool is just:

/* Return -1 if error; 1 if v op w; 0 if not (v op w). */
int
PyObject_RichCompareBool(PyObject *v, PyObject *w, int op)
{
 PyObject *res = PyObject_RichCompare(v, w, op);
 int ok;

 if (res == NULL)
  return -1;
 ok = PyObject_IsTrue(res);
 Py_DECREF(res);
 return ok;
}


How can that be more efficient that PyObject_RichCompare?





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