do...until wisdom needed...

Alex Martelli aleaxit at yahoo.com
Mon Apr 16 03:31:03 EDT 2001


"Ixokai" <news at myNOSPAM.org> wrote in message
news:3ada7eb9$1_5 at goliath2.newsfeeds.com...
> The standard Python Idiom (tm of someone, I'm sure :)) for a do-while
> construct is:
>
> while 1:
>     statements
>     if condition:
>         break

Right.


> Its in-elegant, and even ugly, IMHO. I think there's a reason that there
is
> no do-while construct, otherwise I can't fathom why they wouldn't have put
> it in yet.. this is something that comes up frequently.

I think it's just the general Python approach -- _try_ not to provide many
equivalent ways to express the same design idea, but, rather, _one_
'obviously
right' way.  Of course, this is just an ideal -- in practice, there often
are many
ways to express one idea in Python -- and it's indeed provably impossible to
actually meet it, since people's minds work in sufficiently diverse ways
that
even the most 'obviously right' choices won't be obvious nor feel right to
SOME individuals.  It's still a good idea, "to reach the moon, aim for the
stars", since the alternative, to stuff a language with as many diverse ways
of expression as anybody can possibly think of, leads to language bloat a
la PL/I, Ada, C++, Perl.  The ideal of avoiding redundant features at least
keeps a language _reasonably_ small, although inevitably it will irk those
who have particular attachment to some of the excluded features.


Alex






More information about the Python-list mailing list