[Python-Dev] Ranges
Ka-Ping Yee
pingster@ilm.com
Wed, 12 Jul 2000 12:48:54 -0700 (PDT)
On Wed, 12 Jul 2000, Paul Prescod wrote:
> That's not what I mean. Ignore the range. My point is, if list
> construction and truncation are going to be parallel, they should be
> really parallel.
>
> [0,1,2,3,4,5,6,7,8,10][0:5:2]==[0:5:2]
Did you think they were different?
I thought they *were* parallel. I would expect:
>>> range(0, 5, 2)
[0, 2, 4]
>>> [0:5:2]
[0, 2, 4]
>>> [0,1,2,3,4,5,6,7,8,9,10][0:5:2]
[0, 2, 4]
>>> range(1000)[0:5:2]
[0, 2, 4]
Right?
Am i misunderstanding how [x:y:z] should work?
-- ?!ng