Negative array indicies and slice()

Andrew Robinson andrew3 at r3dsolutions.com
Fri Nov 2 04:57:11 EDT 2012


Hi Ian,

I apologize for trying your patience with the badly written code 
example.  All objects were meant to be ThirdParty(), the demo was only 
to show how a slice() filter could have been applied for the reasons 
PEP357 made index() to exist.
eg: because numpy items passed to __getitems__ via slice syntax [::] 
were illegal values.
PEP 357 is the one who specifically mentioned Numpy types -- which is 
the only reason I used the name in the example;  I could have just as 
well used a string.

I am fully aware of what numpy does -- I have used it; modified the 
fortran interfaces underneath, etc.

The index() method, however, affects *all* list objects in Python, not 
just Numpy's -- correct?

I'll write a working piece of code tomorrow to demonstrate the filter 
very clearly rather than a skeleton, and test it before posting.




More information about the Python-list mailing list