[Python-3000] range() issues

Guido van Rossum guido at python.org
Wed Apr 30 01:48:34 CEST 2008


On Tue, Apr 29, 2008 at 2:18 PM, Benjamin Peterson
<musiccomposition at gmail.com> wrote:
> On Tue, Apr 29, 2008 at 4:09 PM, Mark Dickinson <dickinsm at gmail.com> wrote:
>  > Put another way:  range(n) currently works, in Py3k, for n > sys.maxsize.
>  > What's the rationale for breaking that?
>
>  So we can support other sequence methods. (I think.)
>
>  Personally, I think that range should be just an easy to iterate over
>  a sequence (set, series, or whatever the term is) of integers (even if
>  they're huge). I don't think we need to turn it into a sequence. That
>  fits in your brain. If you need to do something more advanced than
>  counting, there are other things out there! Where are the use cases
>  for range slicing, anyway?

+1

Let's just stop the discussion here and kill all proposals to add
indexing/slicing etc. Sorry, Alexander, but there just isn't anyone
besides you in favor, and nobody has brought up a convincing use case.

__len__ will always be problematic when there are more values than can
be counted in a signed C long; maybe we should do what the Java
collections package does: for once, Java chooses practicality over
purity, and simply states that if the length doesn't fit, the largest
number that does fit is returned (i.e. for us that would be
sys.maxsize in 3.0, sys.maxint in 2.x).

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list