This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients BreamoreBoy, amaury.forgeotdarc, belopolsky, facundobatista, georg.brandl, mark.dickinson, ncoghlan, pitrou, rhettinger, stutzbach
Date 2010-12-03.14:26:41
SpamBayes Score 8.57213e-09
Marked as misclassified No
Message-id <1291386406.0.0.891898333793.issue2690@psf.upfronthosting.co.za>
In-reply-to
Content
I brought the patch up to date for the Py3k branch, but realised just before checking it in that it may run afoul of the language moratorium (since it alters the behaviour of builtin range objects).

However, the .count() and .index() methods (along with the Sequence ABC registration) as well as the O(1) containment testing for integers were already put in place. (I also noticed that the new methods from issue #9213 are not mentioned in the range() docs, unlike the O(1) optimisation)

I've gone ahead and checked it in as r86970, as I see this patch as filling out the promise of the Sequence ABC registration by adding support for slicing and negative indices (with the length caching as more of an implementation detail).

However, I'm also leaving the tracker issue open and assigning to Georg in case he wants to revert it before the beta goes out.

Note that I also fixed the patch so that OverflowError occurs only when encountering an affected operation (primarily indexing and retrieval of the length). If you don't do any of those things, you can make your ranges as large as you like. (The indexing could fairly easily be fixed to eliminate the overflow errors - I just didn't do it in this patch, since it is a separate problem).
History
Date User Action Args
2010-12-03 14:26:46ncoghlansetrecipients: + ncoghlan, georg.brandl, rhettinger, facundobatista, amaury.forgeotdarc, mark.dickinson, belopolsky, pitrou, stutzbach, BreamoreBoy
2010-12-03 14:26:46ncoghlansetmessageid: <1291386406.0.0.891898333793.issue2690@psf.upfronthosting.co.za>
2010-12-03 14:26:42ncoghlanlinkissue2690 messages
2010-12-03 14:26:42ncoghlancreate