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.

----------
messages: 270147
nosy: Elizacat
priority: normal
severity: normal
status: open
title: Slicing strings out of bounds does not raise IndexError
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27479>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to