Re: Extended slices and indices

2006-09-23 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Robert Kern wrote: >> I'd say bug in the .indices() method. The meaning of [4:-1:-1] is unavoidable >> different than [::-1] since the index -1 points to the last element, not the >> imaginary element before the first element. Unfortunately, there *is* no >> concrete (sta

Re: Extended slices and indices

2006-09-23 Thread GavinCrooks
Robert Kern wrote: > I'd say bug in the .indices() method. The meaning of [4:-1:-1] is unavoidable > different than [::-1] since the index -1 points to the last element, not the > imaginary element before the first element. Unfortunately, there *is* no > concrete (start, stop, step) tuple that wil

Re: Extended slices and indices

2006-09-23 Thread Robert Kern
[EMAIL PROTECTED] wrote: > The indices method of slice doesn't seem to work quite how I would > expect when reversing a sequence. > > For example : s = '01234' s[::-1] > '43210' s[slice(None,None,-1) ] > '43210' > > So a slice with a negative step (and nothing else) reverses the >

Extended slices and indices

2006-09-23 Thread GavinCrooks
The indices method of slice doesn't seem to work quite how I would expect when reversing a sequence. For example : >>> s = '01234' >>> s[::-1] '43210' >>> s[slice(None,None,-1) ] '43210' So a slice with a negative step (and nothing else) reverses the sequence. But what are the corresponding indi