Debugging (was Re: Why not allow empty code blocks?)
BartC
bc at freeuk.com
Tue Aug 2 15:14:12 EDT 2016
On 02/08/2016 18:57, Steven D'Aprano wrote:
> On Wed, 3 Aug 2016 03:12 am, BartC wrote:
>
>> That's not a fundamental language feature. Repeat-N is. And if properly
>> designed, isn't an extra feature at all but a special case of a generic
>> loop.
>
> Which means it is NOT a fundamental language feature.
>
> "Repeat N without tracking the loop variable" is just a special case
> of "repeat N with tracking the loop variable", where you don't actually
> care what the loop variable is.
It's fundamental in that, when giving instructions or commands in
English, it frequently comes up when you want something done a set
number of times:
"Give me 20 push-ups"
"Press space 5 times"
"Do 10 laps"
Whoever has to execute these may need to keep count somehow, but that is
not the concern of the person giving the commands.
You wouldn't say, count from 1 to 20, and for each value in turn, do a
push-up. You could also say count backwards from 95 to 0 in fives; same
effect. There are so many ways of specifying a loop that is executed 20
times, that no one way can be the right one. So that extra information
is irrelevant.
--
Bartc
More information about the Python-list
mailing list