[issue13201] Implement comparison operators for range objects

2011-10-23 Thread Roundup Robot
Roundup Robot 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. http://hg.python.org/cpython/rev/479a7dd1ea6a -- nosy: +

[issue13201] Implement comparison operators for range objects

2011-10-23 Thread Mark Dickinson
Changes by Mark Dickinson : -- resolution: -> fixed stage: commit review -> committed/rejected status: open -> closed ___ Python tracker ___

[issue13201] Implement comparison operators for range objects

2011-10-23 Thread Mark Dickinson
Mark Dickinson 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 ___ __

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Sven Marnach
Sven Marnach 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 tracker

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Sven Marnach
Sven Marnach 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 ___ __

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Mark Dickinson
Mark Dickinson added the comment: Ah, there it is. Never mind. :-) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Mark Dickinson
Mark Dickinson added the comment: Hmm. Why does my patch not get a 'review' button? -- ___ Python tracker ___ ___ Python-bugs-list m

[issue13201] Implement comparison operators for range objects

2011-10-22 Thread Mark Dickinson
Mark Dickinson 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 check that range.__ha

[issue13201] Implement comparison operators for range objects

2011-10-20 Thread STINNER Victor
STINNER Victor 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: +haypo __

[issue13201] Implement comparison operators for range objects

2011-10-20 Thread Mark Dickinson
Mark Dickinson 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 of days in case anyo

[issue13201] Implement comparison operators for range objects

2011-10-18 Thread Sven Marnach
Sven Marnach 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: http://bugs.python.org/file23441/range-compare-v3.patch __

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Mark Dickinson
Mark Dickinson 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 Doc/whatsnew/3.3.rst, to

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Sven Marnach
Sven Marnach 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
Changes by Mark Dickinson : -- assignee: -> mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Ezio Melotti
Changes by Ezio Melotti : -- keywords: +needs review, patch nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Mark Dickinson
Mark Dickinson added the comment: Nice patch! I put some comments on Rietveld. -- ___ Python tracker ___ ___ Python-bugs-list mailin

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Mark Dickinson
Changes by Mark Dickinson : -- components: +Interpreter Core nosy: +mark.dickinson stage: -> patch review type: -> feature request versions: +Python 3.3 ___ Python tracker ___

[issue13201] Implement comparison operators for range objects

2011-10-17 Thread Sven Marnach
New submission from Sven Marnach : 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 values they represent.