[Python-Dev] range objects in 3.x
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Sep 29 00:36:21 CEST 2011
Fernando Perez wrote:
> Now, I *suspect* (but don't remember for sure) that the option to have it
> right-hand-open-ended was to match the mental model people have for range:
>
> In [5]: linspace(0, 10, 10, endpoint=False)
> Out[5]: array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
>
> In [6]: range(0, 10)
> Out[6]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
My guess would be it's so that you can concatenate two sequences
created with linspace covering adjacent ranges and get the same
result as a single linspace call covering the whole range.
> I do hope, though, that the chosen name is *not*:
>
> - 'interval'
>
> - 'interpolate' or similar
Would 'subdivide' be acceptable?
--
Greg
More information about the Python-Dev
mailing list