Issue 33424: 4.4. break and continue Statements, and else Clauses on Loops (original) (raw)

Issue33424

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:00 admin set github: 77605
2018-05-04 06:38:23 steven.daprano set nosy: + steven.dapranomessages: +
2018-05-04 03:10:36 tim.peters set status: open -> closednosy: + tim.petersmessages: + resolution: rejectedstage: resolved
2018-05-04 03:07:20 joesatriani create