"for" with "else"?
Mark Jackson
mjackson at alumni.caltech.edu
Thu Sep 25 11:45:50 EDT 2003
"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.
--
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