On Mon, Oct 19, 2009 at 1:55 PM, inhahe <inh...@gmail.com> wrote:
> > > On Sat, Oct 10, 2009 at 6:34 PM, Mensanator <mensana...@aol.com> wrote: > >> On Oct 10, 5:02�pm, kj <no.em...@please.post> wrote: >> > In <01ccc46d-5ea9-4dfe-ba22-699c6b859...@v36g2000yqv.googlegroups.com> >> Mensanator <mensana...@aol.com> writes: >> > >> > In fact, if it were up to me, I would have made the fundamental >> > looping construct something like >> > >> > repeat: >> > � � � ... >> > � � � if whatever(): >> > � � � � � �break >> > � � � ... >> >> So, the second set of '...' doesn't get executed. >> >> When I use >> >> while not done: >> ... >> if n==1: done = True >> ... >> >> the loop will actually complete (which is what >> I want) instead of aborting, like yours does. >> I just don't want the loop to execute again. >> >> > Of course, this is why you would use "while not done" instead of "while > True" or "repeat" in that situation, so i'm not sure what your contention > is. > > >> Now, if I did a break before writing to the file, >> I would have to do all kinds of clean-up code >> outside the loop, code that would be run only >> if the exit were abnormal. >> >> > This is why I propose an "until" keyword. > > until n == 1: > ... > > i know some people don't like to add keywords "unnecessarily," but i really > like to be able to express programs in a way that reflects what we actually > mean, when there's a simple way this could be provided and it's a common use > case. > > i recognize the problem with my solution is that "n" might not even be > defined until somewhere in the loop after "until n == 1" is evaluated. this > makes it a little weird, but it's not strictly a problem since the > interpreter doesn't actually have to evaluate "n == 1" until the tail end of > the loop. > > > > >> > and made all the other looping constructs as syntatic sugar for >> > this one. >> >> Luckily, it's not up to you. >> > > condescending and manipulative, as it merely begs the question of luckily > for whom -- him, or you > > >> > >> > kj >> >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > >
-- http://mail.python.org/mailman/listinfo/python-list