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: [doc] inconsistent range example output
Type: behavior Stage:
Components: Documentation Versions: Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: bleuse, docs@python, georg.brandl
Priority: normal Keywords:

Created on 2015-03-02 08:21 by bleuse, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg237029 - (view) Author: Raphaël Bleuse (bleuse) Date: 2015-03-02 08:21
Reading the documentation for ranges (see https://docs.python.org/3.5/library/stdtypes.html#ranges), the example using a negative index output is inconsistent with the range effective behaviour.

One can read:
"
>>> r[-1]
18
"

while (in my understanding) it should be:
"
>>> r[-1]
8
"

Note the output should be 8 and not 18.

Raphaël
msg237033 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2015-03-02 08:56
The example is correct.  "r" is a range(0, 20, 2), whose last element is 18.
History
Date User Action Args
2022-04-11 14:58:13adminsetgithub: 67747
2015-03-02 08:56:30georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg237033

resolution: not a bug
2015-03-02 08:21:16bleusecreate