This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Errata on page:http://docs.python.org/library/stdtypes.html
Type: Stage:
Components: Documentation Versions: Python 2.7, Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: doerwalter, georg.brandl, jatin085
Priority: normal Keywords:

Created on 2010-04-12 09:11 by jatin085, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg102927 - (view) Author: Jatin Sanghvi (jatin085) Date: 2010-04-12 09:11
Open link: http://docs.python.org/library/stdtypes.html

The statement:

If i or j is negative, the index is relative to the end of the string: len(s) + i or len(s) + j is substituted.

is incorrect, should be:

If i or j is negative, the index is relative to the end of the string: len(s) - i or len(s) - j is substituted.
msg102928 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2010-04-12 09:17
This is a common thinko. ;)

If i is negative then len(s) - i would be greater that len(s). However len(s) + i  is correct. Example:

foo[-1] is foo[len(foo) + (-1)] is foo[len(foo)-1]
History
Date User Action Args
2022-04-11 14:56:59adminsetgithub: 52624
2010-04-12 09:17:06doerwaltersetstatus: open -> closed

nosy: + doerwalter
messages: + msg102928

resolution: not a bug
2010-04-12 09:11:43jatin085create