Looping [was Re: Python and the need for speed]
Antoon Pardon
antoon.pardon at rece.vub.ac.be
Wed Apr 19 08:26:52 EDT 2017
Op 16-04-17 om 19:07 schreef Terry Reedy:
> On 4/16/2017 11:35 AM, Michael Torrie wrote:
>> On 04/16/2017 07:57 AM, bartc wrote:
>>> But people just don't want it.
>>>
>>> /That/ is what surprises me, when people reject things that to me are
>>> no-brainers.
>
> Whereas to me, it is a no-brainer that we are better off *without*
> multiple while/loop constructs.
>
>> I simply don't care about these missing loop constructs.
>
> I do ;-) I consider the current simplicity a feature.
>
> > Python works
>> great for what I use it for, and apparently works well for many people.
>
> The great majority* of 'repetition with variation' is sequentially
> processing items from a collection. Python does that nicely with 'for
> item in collection: process(item)'. While-loops take care of
> everthing else.
Not really, unless you count on the break statement.
But if you count on that, you don't even need a while,
you can start a for loop with a generator that never
stops and use breaks.
There was a time something like the following was
seriously considered for introduction in the language.
do
part1
while condition:
part2
which would be equivalent to the following:
while True:
part1
if not condition:
break
part2
But suddenly this was no longer considered. I still
wish they had followed through. I think such a construct
comes up often enough, to have such a loop construct.
More information about the Python-list
mailing list