[Python-ideas] Where did we go wrong with negative stride?

Ron Adam ron3200 at gmail.com
Tue Oct 29 06:53:27 CET 2013


Meant to send this the list...


On 10/29/2013 12:07 AM, Greg Ewing wrote:
 > Ron Adam wrote:
 >> If the left and right indices are to be considered separate from the
 >> step, we can use this existing legal syntax, and just pass the step after
 >> a comma.
 >>
 >>     a[i:j, k]
 >
 > No, we can't do that, because NumPy uses that for indexing
 > into a 2-dimensional array.

Can you explain why it's an issue?

Currently lists won't accept that,  So NumPy isn't using that spelling with 
lists, and it only requires changing the __getitem__ and __senditem__ 
methods on lists, (which numpy can't be using in this way because it 
currently doens't work.), and it doen't change slice objects, or the slice 
syntax at all?   I can't see how it will effect them.

It's a much smaller change than many of the other sugestions.

Cheers,
    Ron



More information about the Python-ideas mailing list