On Fri, 08 Oct 2010 22:10:35 +0200, Hallvard B Furuseth wrote: > Jed Smith <j...@jedsmith.org> writes: >>>>> a = [1, 2, 3, 4, 5, 6] >>>>> a[::-1] >> [6, 5, 4, 3, 2, 1] > > Nice. Is there a trick to get a "-0" index too? Other than doing 'i or > len(L)' instead of 'i', that is.
What exactly are you expecting? I don't understand why you think that L[-0] and L[0] would be different, when -0 == 0. I'm also unsure why you think that there's anything more ("too") to get -- the example shown reverses the entire list. Perhaps if you show what result you are expecting, we can show what slice to give to get it. >>>> L = [1,2,3,4,5] >>>> L[2:-2], L[2:-1], L[2:-0] # not quite right:-) > ([3], [3, 4], []) -- Steven -- http://mail.python.org/mailman/listinfo/python-list