[docs] Error in Section 3.1.2. of The Python Tutorial

Christopher Brautigam c.n.brautigam at googlemail.com
Tue Jun 18 00:19:44 CEST 2013


To whom it may concern,

I believe I have found a minor error in the example given on String
"slicing" in section 3.1.2. "Strings" of "The Python Tutorial"
documentation.

The error concerns the first example of slicing given (where the variable
"word" is equal to "Python"), which reads:

>>> word[0:2]  # characters from position 0 (included) to 2 (excluded)'Py'>>> word[2:5]  # characters from position 2 (included) to 4 (excluded)'tho'

I believe the second comment is incorrect as the character at the 4th index
"o" is included. I propose that the comment should be changed so that
"excluded" is changed to "included" as below:

>>> word[0:2]  # characters from position 0 (included) to 2 (excluded)'Py'>>> word[2:5]  # characters from position 2 (included) to 4 (included)'tho'

This could also be solved by changing the 4 to a 5 however that statement
would be making the same point as the first and would therefore be
redundant.

Kind Regards,

Christopher Brautigam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130617/7eafda14/attachment-0001.html>


More information about the docs mailing list