[Python-ideas] [Python-Dev] Inclusive Range

Hallvard B Furuseth h.b.furuseth at usit.uio.no
Tue Oct 12 15:14:58 CEST 2010


Steven D'Aprano writes:
> On Fri, 08 Oct 2010 22:10:35 +0200, Hallvard B Furuseth wrote:
>> 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.
>
> 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 don't think that, and I expected just what happened.
As Arnaud Delobelle had answered:  I can use 'i or None'.

-- 
Hallvard



More information about the Python-list mailing list