[Python-Dev] A macro for easier rich comparisons (original) (raw)
Petr Viktorin encukou at gmail.com
Tue Apr 28 17:09:03 CEST 2015
- Previous message (by thread): [Python-Dev] A macro for easier rich comparisons
- Next message (by thread): [Python-Dev] A macro for easier rich comparisons
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Apr 28, 2015 at 4:59 PM, Barry Warsaw <barry at python.org> wrote:
On Apr 28, 2015, at 11:13 AM, Victor Stinner wrote:
It would be nice to have a six module for C extensions. I'm quite sure that many projects are already full of #ifdef PYTHON3 ... #else ... #endif macros. Maybe encapsulating some of the recommendations here: https://wiki.python.org/moin/PortingToPy3k/BilingualQuickRef#Pythonextensionmodules
py3c (or its documentation) now has all that except REPRV (with an alias for the native string type, e.g. "PyStr", you can use that in all reprs, so REPRV strikes me as somewhat redundant).
(We really need to collect all this information in on place.)
#define PyRETURNRICHCOMPARE(val1, val2, op) I think this macro would make a nice addition to the C API. It might read better as
PyRETURNRICHCOMPARE(val1, op, val2)
.
(val1, val2, op) mirrors richcmp and PyObject_RichCompareBool; I think a different order of arguments would just be confusing.
- Previous message (by thread): [Python-Dev] A macro for easier rich comparisons
- Next message (by thread): [Python-Dev] A macro for easier rich comparisons
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]