for / while else doesn't make sense

Rustom Mody rustompmody at gmail.com
Sun Jun 12 23:46:04 EDT 2016


On Monday, June 13, 2016 at 7:42:25 AM UTC+5:30, Steven D'Aprano wrote:
> On Mon, 13 Jun 2016 04:44 am, Michael Selik wrote:
> 
> > On Sun, Jun 12, 2016 at 6:11 AM Steven D'Aprano  wrote:
> > 
> >> - run the for block
> >> - THEN unconditionally run the "else" block
> >>
> > 
> > Saying "unconditionally" is a bit misleading here. As you say, it's
> > conditioned on completing the loop without break/return/raise.
> 
> It's also conditional on the OS not killing the Python process, conditional
> on the CPU not catching fire, conditional on the user not turning the power
> of, and conditional on the sun not exploding and disintegrating the entire
> earth.
> 
> In the absence of any event which interferes with the normal execution of
> code by the Python VM, and in the absence of one of a very few
> explicit "JUMP" statements which explicitly jump out of the compound
> for...else statement, the else clause is unconditionally executed after the
> for clause.
> 
> Happy now?

Wholesale business of strawmen doing brisk business?




More information about the Python-list mailing list