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

Alan Gauld alan.gauld at btinternet.com
Thu Jul 26 09:17:24 CEST 2007


"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!

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list