extended slicing and negative stop value problem

Max Moroz maxmoroz at gmail.com
Sat Aug 20 20:20:47 CEST 2011


Would it be a good idea to change Python definition so that a[10, -1, -1]
referred to the elements starting with position 10, going down to the
beginning?

This would require disabling the "negative stop value means counting from
the end of the array" magic whenever the step value is negative.

The reason for this idea is that many people (me including) try to use
extended slices with negative step values, only to realize that they are
messed up. For example, if your stop value is reduced in a loop from a
positive number to -1, the behavior breaks whenever it hits -1.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110820/4a8a74ae/attachment.html>


More information about the Python-list mailing list