"for" with "else"?

John Roth newsgroups at jhrothjr.com
Thu Sep 25 12:02:55 EDT 2003


"Mark Jackson" <mjackson at alumni.caltech.edu> wrote in message
news:bkv2je$5fs$1 at news.wrc.xerox.com...
> "John Roth" <newsgroups at jhrothjr.com> writes:
> >
> > "Mark Jackson" <mjackson at alumni.caltech.edu> wrote in message
> > news:bkuru4$532$1 at news.wrc.xerox.com...
> > > Invalid User <user at invalid.domain> writes:
> >
> > > (This happens to be the *reverse* of what my intuition expects - it
> > > would seem more natural if the syntax meant "do this for loop to
> > > completion, else do this extra stuff," but this is the way it is and
> > > one must simply remember it.)
> >
> > There's a certain amount of justification, though. You can
> > already put whatever amount of logic you need in the if
> > statement that ends with the break. You don't otherwise
> > have that ability for normal termination of the sequence.
>
> Sure - I wasn't arguing the other meaning was needed, clearly it is
> not.  It's the use of the keyword "else" which creates the [purely
> mental] problem for me.

Good point.

John Roth
>
> -- 
> Mark Jackson - http://www.alumni.caltech.edu/~mjackson
> There are no foolish questions and no man becomes a fool
> until he has stopped asking questions.
> - Charles P. Steinmetz
>
>






More information about the Python-list mailing list