[docs] [issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences
Stephen J. Turnbull
report at bugs.python.org
Sat Apr 22 14:04:58 EDT 2017
Stephen J. Turnbull added the comment:
I prefer Josh's wording. The important point to me is that
>>> [1, 2][2:0] = "AB"
[1, 2, "A", "B"]
not an error or ["B", "A"] == [1, 2][2:0:-1]. I think too much talk about the endpoints obscures this important fact. (I think I'd like it to be an error, since the interpretation of s[2:0] = t could reasonably be any of s[0:0] = t, s[1:1] = t, or s[2:2] = t, but I haven't thought carefully enough yet, and "backward compatibility".)
Note: Josh's wording is already used in 3.7 (https://docs.python.org/dev/library/stdtypes.html#common-sequence-operations, as of the timestamp of this message). I didn't check if it's been backported.
----------
nosy: +sjt
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29352>
_______________________________________
More information about the docs
mailing list