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: 4.4. break and continue Statements, and else Clauses on Loops
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: joesatriani, steven.daprano, tim.peters
Priority: normal Keywords:

Created on 2018-05-04 03:07 by joesatriani, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg316158 - (view) Author: CH (joesatriani) Date: 2018-05-04 03:07
range function second parameter is excluded. Hence for x in range(2, n): will not execute when n = 2, and "2 is a prime number" will never appear.
Moreover, might need a break in the else block too.
msg316159 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2018-05-04 03:10
Closing because this appears to be senseless.
msg316160 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2018-05-04 06:38
Joe, we have no idea what you think is the bug.

It is intentional that the second argument for range is excluded. This is called an "half-open" range, and it helps avoid off-by-one and signpost errors.

Your comments about break, continue and else don't seem to actually mean anything. Please write in complete English sentences and explain the nature of the supposed bug.
History
Date User Action Args
2022-04-11 14:59:00adminsetgithub: 77605
2018-05-04 06:38:23steven.dapranosetnosy: + steven.daprano
messages: + msg316160
2018-05-04 03:10:36tim.peterssetstatus: open -> closed

nosy: + tim.peters
messages: + msg316159

resolution: rejected
stage: resolved
2018-05-04 03:07:20joesatrianicreate