negative stride list slices

David Abrahams dave at boost-consulting.com
Wed Sep 1 13:41:09 EDT 2004


Can anyone explain the logic behind the behavior of list slicing with
negative strides?  For example:

  >>> print range(10)[:-3:-1]
  [9,8]

I found this result very surprising, and would just like to see the
rules written down somewhere.

Thanks,
--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com



More information about the Python-list mailing list