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.

Author Chas Belov
Recipients Chas Belov
Date 2020-05-14.06:12:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589436772.42.0.96031331267.issue40620@roundup.psfhosted.org>
In-reply-to
Content
I found https://docs.python.org/3.7/tutorial/controlflow.html#the-range-function section 4.3 confusing. The range() Function shows the following example:

>>> for i in range(5):
...     print(i)
...
0
1
2
3
4

[some instructional text]

range(5, 10)
   5, 6, 7, 8, 9

range(0, 10, 3)
   0, 3, 6, 9

range(-10, -100, -30)
  -10, -40, -70

This appears to be an instruction to type, for example:
range(5, 10)
at the prompt, and that the response will be:
   5, 6, 7, 8, 9

leading to a perceived bug when I type at the prompt:
>>> range(5, 10)
and receive the response
range(5, 10)

I ultimately figured out that the example is a shorthand to substitute
range(5, 10)
for the original 
range(5)

>>> for i in range(5, 10):
...     print(i)
...
5
6
7
8
9

It would be less confusing if the example instead read:

----------------------------

Substituting "range(5, 10)" for "range(5)" results in (one number per line)
5, 6, 7, 8, 9

Substituting "range(0, 10, 3)" results in
0, 3, 6, 9

and substituting "range(-10, -100, -30)" results in
-10, -40, -70

---------------------------

such that it is clear that the statements are not meant to be taken as literal stand-alone entries to be typed at the prompt but are instead substitutions.
History
Date User Action Args
2020-05-14 06:12:52Chas Belovsetrecipients: + Chas Belov
2020-05-14 06:12:52Chas Belovsetmessageid: <1589436772.42.0.96031331267.issue40620@roundup.psfhosted.org>
2020-05-14 06:12:52Chas Belovlinkissue40620 messages
2020-05-14 06:12:51Chas Belovcreate