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

Arnaud Delobelle arnodel at gmail.com
Fri Oct 8 22:15:39 CEST 2010


Jed Smith <jed at jedsmith.org> writes:

> On Fri, Oct 8, 2010 at 1:26 PM, Steven D'Aprano
> <steve at remove-this-cybersource.com.au> wrote:
>> On Fri, 08 Oct 2010 10:21:16 +0200, Antoon Pardon wrote:
>>
>>> Personnaly I find it horrible
>>> that in the following expression: L[a:b:-1], it is impossible to give a
>>> numeric value to b, that will include L[0] into the reversed slice.
    ^^^^^^^^^^^^^^^^^^
>>
>>
>>
>>>>> L = [1, 2, 3, 4, 5]
>>>>> L[5:-6:-1]
>> [5, 4, 3, 2, 1]
>
>>>> a = [1, 2, 3, 4, 5, 6]
>>>> a[::-1]
> [6, 5, 4, 3, 2, 1]

b doesn't have a numeric value though.

-- 
Arnaud



More information about the Python-list mailing list