Re: [Tutor] Array slices in python with negative step

2010-01-11 Thread vishwajeet singh
On Tue, Jan 12, 2010 at 1:16 AM, Alan Gauld wrote: > > "vishwajeet singh" wrote > > Thanks for your response but I am still not clear; can you show me the >> equivalent of [::-1] in terms actually specifying start-index, end-index >> which gives me reverse of the given arrary. >> > > I don't th

Re: [Tutor] Array slices in python with negative step

2010-01-11 Thread Alan Gauld
"vishwajeet singh" wrote Thanks for your response but I am still not clear; can you show me the equivalent of [::-1] in terms actually specifying start-index, end-index which gives me reverse of the given arrary. I don't think you can, you must use the empty value. In theory you could use

Re: [Tutor] Array slices in python with negative step

2010-01-11 Thread Michael Sprayberry
> > Hello All, > > > > I am bit confuse how the slice works in case a negative step is supplied > > a = 'abcde' > > a[::-1] gives me edcba > > > > but [4:0:-1] gives me edcb > > > > while searching net I came accross something which said the following: > > > > If a negative stride is specified and

Re: [Tutor] Array slices in python with negative step

2010-01-11 Thread vishwajeet singh
On Mon, Jan 11, 2010 at 10:32 PM, spir wrote: > On Mon, 11 Jan 2010 21:50:10 +0530 > vishwajeet singh wrote: > > > Hello All, > > > > I am bit confuse how the slice works in case a negative step is supplied > > a = 'abcde' > > a[::-1] gives me edcba > > > > but [4:0:-1] gives me edcb > > > > whi

Re: [Tutor] Array slices in python with negative step

2010-01-11 Thread spir
On Mon, 11 Jan 2010 21:50:10 +0530 vishwajeet singh wrote: > Hello All, > > I am bit confuse how the slice works in case a negative step is supplied > a = 'abcde' > a[::-1] gives me edcba > > but [4:0:-1] gives me edcb > > while searching net I came accross something which said the following:

[Tutor] Array slices in python with negative step

2010-01-11 Thread vishwajeet singh
Hello All, I am bit confuse how the slice works in case a negative step is supplied a = 'abcde' a[::-1] gives me edcba but [4:0:-1] gives me edcb while searching net I came accross something which said the following: If a negative stride is specified and the starting or stopping indices are omi