[issue23699] Add a macro to ease writing rich comparisons

Stefan Krah report at bugs.python.org
Mon May 18 15:46:09 CEST 2015


Stefan Krah added the comment:

The problem with this macro is that most of the time it takes the
standard cmp return value {-1,0,1} and converts that into a bool.

For this use case, it might be more appropriate to use a
static inline function Py_cmp_to_bool().

To put it differently, the macro mostly does not perform the
actual rich comparison but just post-processes the result.


I don't like the dual use of converting cmp() return values
and performing actual comparisons on integers, so -1 on
the concept.

----------

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


More information about the Python-bugs-list mailing list