[issue13201] Implement comparison operators for range objects

2011-10-23 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: In most cases, global variables Py_Zero and Py_One would be enough to simplify this kind of code. Agreed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201

[issue13201] Implement comparison operators for range objects

2011-10-23 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201 ___

[issue13201] Implement comparison operators for range objects

2011-10-23 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 479a7dd1ea6a by Mark Dickinson in branch 'default': Issue #13201: equality for range objects is now based on equality of the underlying sequences. Thanks Sven Marnach for the patch.

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: I've taken the liberty of updating the patch, with a few minor changes: range_equality - range_equals (like range_contains) move identity check into range_equals move comments before the code they describe (PEP7) add whatsnew entry remove

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Hmm. Why does my patch not get a 'review' button? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201 ___

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Ah, there it is. Never mind. :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201 ___

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Sven Marnach
Sven Marnach s...@marnach.net added the comment: Thanks for the updates, Mark. I was just about to look into this again. The changes are fine with me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Sven Marnach
Sven Marnach s...@marnach.net added the comment: Victor Stinner wrote: If would be nice to have a PyLong_CompareLong() function. In most cases, global variables Py_Zero and Py_One would be enough to simplify this kind of code. -- ___ Python

[issue13201] Implement comparison operators for range objects

2011-10-20 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: I get a test failure in test_hash (which is checking exactly that the hash(range) uses the default object hash, so that test is clearly out of date now). Apart from that, the latest patch looks good to me. I'm going to give this a couple

[issue13201] Implement comparison operators for range objects

2011-10-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: +one = PyLong_FromLong(1); +if (!one) +return -1; +cmp_result = PyObject_RichCompareBool(r0-length, one, Py_EQ); +Py_DECREF(one); If would be nice to have a PyLong_CompareLong() function. -- nosy:

[issue13201] Implement comparison operators for range objects

2011-10-18 Thread Sven Marnach
Sven Marnach s...@marnach.net added the comment: Mark, thanks again for your comments. (I never looked at the Python source code before, so tey are highly appreciated.) I uploaded a new version of the patch hopefully. -- Added file:

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Sven Marnach
New submission from Sven Marnach s...@marnach.net: It seems some sort of consensus on how to compare range objects has emerged from the python-ideas discussion on comparison of range objects [1]. The attached patch defines '==' and '!=' for range object equality based on the sequence of

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- components: +Interpreter Core nosy: +mark.dickinson stage: - patch review type: - feature request versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Nice patch! I put some comments on Rietveld. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201 ___

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- keywords: +needs review, patch nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201 ___

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: - mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13201 ___ ___

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Sven Marnach
Sven Marnach s...@marnach.net added the comment: Mark, thanks for your comments. Here's a new version of the patch, I answer on Rietveld. -- Added file: http://bugs.python.org/file23429/range-compare-v2.patch ___ Python tracker

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: The new patch looks fine; I'd still like to have the more explicit reference counting in range_hash (see replies on Rietveld). A few more things: - The patch needs a Misc/NEWS entry before committing; it probably deserves a line in