[Python-Dev] Three argument slices.

Finn Bock bckfnn@worldonline.dk
Sat, 04 Nov 2000 18:41:59 GMT


>> - JPython sequences support three argument slices. i.e. 
>>   range(3)[::-1] == [2,1,0]. 
>>   CPython should be fixed.
>> 
>> Is this actually true? Should (and will cpython) change in this
>> respect?
>
>Well, there's a patch I wrote on sf to add this to CPython, but it was
>too late for 2.0 and it got postponed.
>
>Does J[P]ython allow
>
>l = range(10)
>l[::3] = range(4)
>
>?  That's one of the odder bits of the behaviour of my patch.

No:

Jython 2.0 pre-alpha on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more information.
>>> l = range(10)
>>> l[::3] = range(4)
Traceback (innermost last):
  File "<console>", line 1, in ?
ValueError: step size must be 1 for setting list slice

regards,
finn