[issue27479] Slicing strings out of bounds does not raise IndexError

2016-07-10 Thread Eryk Sun
Eryk Sun added the comment: This is documented behavior for the built-in sequence types [1], and it's also mentioned in the tutorial [2]. The indices() method of a slice object shows the resolved bounds for given sequence length: >>> slice(-1000, 1000, 1).indices(4) (0, 4, 1) >>>

[issue27479] Slicing strings out of bounds does not raise IndexError

2016-07-10 Thread Elizabeth Myers
Changes by Elizabeth Myers : -- components: +Interpreter Core ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue27479] Slicing strings out of bounds does not raise IndexError

2016-07-10 Thread Elizabeth Myers
New submission from Elizabeth Myers: When slicing strings, IndexError is not raised when the slices are out of bounds, even for negative indexes. Like so: >>> "test"[-1000:1000] 'test' >>> "test"[-1000:1] 't' >>> ""[-100:100] '' This seems more like a bug than useful behaviour to me. --

[issue27479] Slicing strings out of bounds does not raise IndexError

2016-07-10 Thread Elizabeth Myers
Changes by Elizabeth Myers : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail