Looping [was Re: Python and the need for speed]
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
> 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.
which would be equivalent to the following:
if not condition:
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