Author josh.r
Recipients akira, docs@python, josh.r
Date 2017-01-24.19:08:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I think the wording could be improved, but there is another option I wanted to put here. Right now, we're being overly detailed about the implementation, specifying the bounds substitutions performed. If we're just trying to describe logical behavior, we could simplify footnote 4 to, dropping explicit descriptions for "out of bounds" cases, getting:

The slice of *s* from *i* to *j* is defined as the sequence of items with index *k* such that ``i <= k < j`` and ``0 <= k < len(s)``. If *i* is omitted or ``None``, use ``0``. If *j* is omitted or ``None``, use ``len(s)``. If *i* is greater than or equal to *j*, the slice is empty.

That avoids needing to be explicit about substitutions in the < -len(s) case and > len(s) cases, since limiting the values of k to the intersection of range(i, j) and range(len(s)) covers both ends. I considered a single range, like ``max(0, i) <= k < min(j, len(s))``, but that wouldn't describe the upper bound on i or the lower bound on j properly, and ``min(max(0, i), len(s)) <= k < min(max(0, j), len(s))`` is ugly. Footnote 3 covers the adjustment for negative values already, which allows for the simpler description.
Date User Action Args
2017-01-24 19:08:30josh.rsetrecipients: + josh.r, docs@python, akira
2017-01-24 19:08:30josh.rsetmessageid: <>
2017-01-24 19:08:30josh.rlinkissue29352 messages
2017-01-24 19:08:29josh.rcreate