Message123250
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). |
|
Date |
User |
Action |
Args |
2010-12-03 14:26:46 | ncoghlan | set | recipients:
+ ncoghlan, georg.brandl, rhettinger, facundobatista, amaury.forgeotdarc, mark.dickinson, belopolsky, pitrou, stutzbach, BreamoreBoy |
2010-12-03 14:26:46 | ncoghlan | set | messageid: <1291386406.0.0.891898333793.issue2690@psf.upfronthosting.co.za> |
2010-12-03 14:26:42 | ncoghlan | link | issue2690 messages |
2010-12-03 14:26:42 | ncoghlan | create | |
|