Re: [Python-Dev] A macro for easier rich comparisons

2015-04-30 Thread Petr Viktorin
On Tue, Apr 28, 2015 at 4:59 PM, Barry Warsaw 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

Re: [Python-Dev] A macro for easier rich comparisons

2015-04-30 Thread Petr Viktorin
On Tue, Apr 28, 2015 at 11:13 AM, Victor Stinner wrote: > Hi, > > 2015-04-27 16:02 GMT+02:00 Petr Viktorin : >> A macro like this would reduce boilerplate in stdlib and third-party C >> extensions. It would ease porting C extensions to Python 3, where rich >> comparison is mandatory. > > It would

Re: [Python-Dev] A macro for easier rich comparisons

2015-04-28 Thread David Malcolm
On Tue, 2015-04-28 at 10:50 -0700, Glenn Linderman wrote: > On 4/28/2015 2:13 AM, Victor Stinner wrote: > > > > #define Py_RETURN_RICHCOMPARE(val1, val2, op) > > > \ > > > > do { > > > > \ > > >

Re: [Python-Dev] A macro for easier rich comparisons

2015-04-28 Thread Glenn Linderman
On 4/28/2015 2:13 AM, Victor Stinner wrote: #define Py_RETURN_RICHCOMPARE(val1, val2, op) \ > do {\ > switch (op) { \ > case

Re: [Python-Dev] A macro for easier rich comparisons

2015-04-28 Thread Barry Warsaw
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/Port

Re: [Python-Dev] A macro for easier rich comparisons

2015-04-28 Thread Victor Stinner
Hi, 2015-04-27 16:02 GMT+02:00 Petr Viktorin : > A macro like this would reduce boilerplate in stdlib and third-party C > extensions. It would ease porting C extensions to Python 3, where rich > comparison is mandatory. It would be nice to have a six module for C extensions. I'm quite sure that m

[Python-Dev] A macro for easier rich comparisons

2015-04-28 Thread Petr Viktorin
It seems the discussion on python-ideas, and also the patch review, died down. So I'm posting to python-dev. A macro like this would reduce boilerplate in stdlib and third-party C extensions. It would ease porting C extensions to Python 3, where rich comparison is mandatory. #define Py_RETURN_RIC