[New-bugs-announce] [issue17287] slice inconsistency
Elazar Gershuni
report at bugs.python.org
Sun Feb 24 13:49:20 CET 2013
New submission from Elazar Gershuni:
slice behavior is not consistent for negative lower or upper arguments, which could be surprising:
>>> 'hello'[:-2]
'hel'
>>> 'hello'[:-1]
'hell'
>>> 'hello'[:-0]
''
this is obvious when written as literal, but not so obvious when using variables in expressions like 'fullname[:-len(lastname)]'. same goes for 'lower'.
----------
components: None
messages: 182874
nosy: elazar
priority: normal
severity: normal
status: open
title: slice inconsistency
type: enhancement
versions: Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17287>
_______________________________________
More information about the New-bugs-announce
mailing list