why no "do : until"?

Peter Hansen peter at engcorp.com
Thu Jan 4 00:29:35 EST 2001


Bjorn Pettersen wrote:
> 
> Peter Hansen wrote:
> > [snip]
> > You are a cowboy-hacker type of programmer, not one working as a serious
> > software engineer in a group environment, right?  Or, if the latter, your
> > management just hasn't caught on yet.
> 
> Ad hominem attacks are out of place on c.l.py

I tried to pose it as more of a question than an attack.  Anyway, you're 
directing your attack (I mean comment) at someone replying to an
individual 
who has persistently attacked the intelligence of others replying calmly 
to his postings, so perhaps your comments are misdirected.  (Oops, do you
consider that an attack, too?  Sorry, I guess I can't tell.  Personally,
I consider blanket statements about what is and is not appropriate on
Usenet to be attacks, but that's another story.)

> > Seriously, nobody who really programs for a living instead of as a hobby
> > should (in my opinion) have the attitude you express above towards a
> > maintenance issue such as this.  In my opinion.  Nothing personal.
> 
> Personally, I find it more problematic to manage all the possible places in a while
> 1 loop that an exit can take place. While an unfortunate variable initialization
> isn't good by any means, I would expect a loop that wasn't entered to be caught by
> the test harness, having a loop accidentally exit because you forgot to change one
> of the exit conditions might be harder to catch -- which incidentally is why I don't

I agree that there are a variety of ways in which maintenance can be an 
issue, and a loop with multiple exits is probably no better than a
function
with multiple exits.  On the other hand, with break and continue
statements, 
and a loop-exit flag appropriate to the situation, the while (1) loop
is easily turned into a while (not done) loop and the maintenance problem
is minimized.

The "special value as initializer" situation is equally easy to remedy,
as we've seen.  The point is that in either case the code doesn't
implement
the desired solution well, or the solution is too complex for the problem.
All we've been doing here is trying to point out the way(s) in which the
initialization issue can be a Bad Thing, as multiple exits can be.

> Since nobody is going to change their mind at this point, can we hope that this
> thread will die?

We can hope, but perhaps some of us are still finding interesting
viewpoints
worth considering.  I'm happy you pointed out that downside of my off-hand
remark about allowing multiple exit points from a "while (1)" loop, and
perhaps others are learning something new.

If people don't want to participate, no one's stopping them...

Cheers!
-Peter



More information about the Python-list mailing list