[Python-ideas] [Python-Dev] Inclusive Range
Arnaud Delobelle
arnodel at gmail.com
Fri Oct 8 16:23:33 EDT 2010
Hallvard B Furuseth <h.b.furuseth at usit.uio.no> writes:
> Jed Smith <jed at 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.
>
>>>> L = [1,2,3,4,5]
>>>> L[2:-2], L[2:-1], L[2:-0] # not quite right:-)
> ([3], [3, 4], [])
'i or None'
--
Arnaud
More information about the Python-list
mailing list