A very minor proposed improvement to readability of 3.1.2. Strings - section on Slice

Currently reads: Note how the start is always included, and the end always excluded. This makes sure that s[:i] + s[i:] is always equal to s:
The statement “…and the end always excluded.” Is not true. If the end was excluded then s[:i] + s[i:] would never equal to s. If it excluded the end of the example “Python” then s would be “Pytho”, not “Python”. I was going to say “You could say “Note how the start is always included, and since an omitted first index defaults to zero, the end is always excluded. However, if you add “s[i:]” which defaults to the count (starting at 1) of the number of characters in the string being sliced, the end would also always be included.”
Should a mention be made that including any number larger than the count (starting at 1) will always include the last character in the string with no error message?
Sam Duncan Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
participants (1)
-
Samuel DUNCAN