title: Why does this "[::-1]" return a reversed list in Python?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/509211/good-primer-for-python-slice-notation">Good Primer for Python Slice Notation</a><br>
    <a href="https://stackoverflow.com/questions/766141/reverse-a-string-in-python">reverse a string in Python</a>  </p>
  </blockquote>
  
  
  
  <p>I've seen this syntax crop up in a few code snippets I've seen lately, and I'm curious as to what it does. If I have <code>my_list = [1,2,3,4,5]</code>, and I execute <code>my_list[::-1]</code>, I'm given a list with the elements reversed <code>[5,4,3,2,1]</code>. Could someone please explain to me what this actually does, and show the difference between <code>[:]</code> notation and <code>[::]</code>? Or at least refer me to a resource that does.</p>
  
  <p>I'm sure if I had a good Python book it would be in there, but I don't. And it's impossible to search Google for something like this since the <code>[::]</code> gets ignored. Thanks!</p>