Re: [Python-Dev] Negative slice steps considered unhealthy (extended slicing for lists)

"Fredrik Lundh" <effbot@telia.com> writes:
The problem is that for slices (& indexes in general) that negative indices have a special interpretation: range(10,-1,-1) range(10)[:-1] Personally I don't think it's that bad (you just have to remember to write :: instead of :-1: when you want to step all the way back to the beginning). More serious is what you do with out of range indices - and NumPy is a bit odd with this one, it seems:
What's that initial "0" doing there? Can someone who actually understands NumPy explain this? Cheers, M. (PS: PySlice_GetIndices is in practice a bit useless because when it fails it offers no explanation of why! Does any one use this function, or should I submit a patch to make it a bit more helpful (& support longs)?) -- -Dr. Olin Shivers, Ph.D., Cranberry-Melon School of Cucumber Science -- seen in comp.lang.scheme
participants (1)
-
Michael Hudson