On Fri, 05 Mar 2010 18:12:05 +0000, Arnaud Delobelle wrote: >>>> l = range(10) >>>> l > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>> l[7::-1] > [7, 6, 5, 4, 3, 2, 1, 0] >>>> [l[i] for i in range(7, -1, -1)] > [7, 6, 5, 4, 3, 2, 1, 0]
Where does the first -1 come from? Slices are supposed to have default values of 0 and len(seq): >>> l[7::1] [7, 8, 9] >>> [l[i] for i in range(7, len(l), 1)] [7, 8, 9] >>> [l[i] for i in range(7, len(l), -1)] [] I don't believe the actual behaviour is documented anywhere. -- Steven -- http://mail.python.org/mailman/listinfo/python-list