[issue23699] Add a macro to ease writing rich comparisons

Petr Viktorin report at bugs.python.org
Fri Mar 20 15:33:30 CET 2015


Petr Viktorin added the comment:

Making it a function might help with the following issues:
- series of comparisons and PyBool_FromLong is less efficient than switch and Py_RETURN_*. But it would add a function call.
- it might be too complex for a macro

Do you think that would help?

As for the signature, I would like this to mirror richcmpfunc and PyObject_RichCompareBool. And returning PyObjexct*, not 0/1, is an important part of reducing boilerplate; in cases where 0/1 would be helpful you can easily work with cmp-style -1/0/1 values before using this to convert them.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23699>
_______________________________________


More information about the Python-bugs-list mailing list