[Tutor] What exactly is [::-1]?

Dick Moores rdm at rcblue.com
Thu Jul 26 09:43:21 CEST 2007


At 12:17 AM 7/26/2007, Alan Gauld wrote:

>"Dick Moores" <rdm at rcblue.com> wrote
>
> >>I could send you a link but I'd just google 'python list slicing' to
> >>find it, so I'll leave that as an exercise for the reader.
> >
> > I don't find Google of help with this. Could someone supply a link?
>
>Not sure why it didn't help you Dick, but it led me to:
>
>http://docs.python.org/lib/typesseq.html
>
>Which is admittedly sparing in its explanation but does at
>least describe the three values involved and their defaults.
>
>The tutorial also threw up this:
>
>http://docs.python.org/tut/node5.html
>
>Which describes basic slicing (using only 2 indices) of strings
>and also has a link to the previous reference page.
>
>Finally I tried googling for 'python slicing' and got this as my first
>hit:
>
>http://docs.python.org/ref/slicings.html
>
>Which is the language lawyers version!

Alan, I don't see an explanation of [::-1] anywhere in those 3 links. 
There needs to be a clear description and better examples somewhere 
in the docs, IMO.

My thanks to Luke and Wesley.

Dick




More information about the Tutor mailing list