Possible improvement to slice opperations.

Szabolcs Nagy nszabolcs at gmail.com
Mon Sep 5 05:08:24 EDT 2005


with the current syntax L[i:i+1] returns [L[i]], with nxlist it returns
L[i+1] if i<0.

L=range(10)
L[1:2]==[L[1]]==[1]
L[-2:-1]==[L[-2]]==[8]

L=nxlist(range(10))
L[1:2]==[L[1]]==[1]
L[-2:-1]==[L[-1]]==[9] # not [L[-2]]

IMHO in this case current list slicing is more consistent.




More information about the Python-list mailing list