on.org
Subject: Re: Friday Finking: Contorted loops
On 2021-09-12 17:11:58 -0400, Avi Gross via Python-list wrote:
> Yes, large units of code, and even smaller ones, may be a chore to
> figure out. Arguably harder when you use indentation and the next/last
> parts are not even on the same scr
On 2021-09-12 17:11:58 -0400, Avi Gross via Python-list wrote:
> Yes, large units of code, and even smaller ones, may be a chore to figure
> out. Arguably harder when you use indentation and the next/last parts are
> not even on the same screen as the rest. Sometimes you want to use a
> split-scree
On 12/09/2021 09:11, jak wrote:
> if the only way to terminate a 'while True' loop is by using the 'break'
> statement, why is it allowed to add the 'else' statement which will only
> contain dead code?
>
> while True:
> break
> else:
> print('dead code')
>
Because to the interpreter
power can come great responsibility to use it well
and make sure others can figure it out.
-Original Message-
From: Python-list On
Behalf Of Peter J. Holzer
Sent: Sunday, September 12, 2021 4:49 PM
To: python-list@python.org
Subject: Re: Friday Finking: Contorted loops
On 2021-09-12 10:2
On 2021-09-12 10:28:22 -0700, 2qdxy4rzwzuui...@potatochowder.com wrote:
> On 2021-09-11 at 18:21:17 +0100,
> Alan Gauld via Python-list wrote:
> > On 11/09/2021 15:41, Peter J. Holzer wrote:
> > > How is C's do/while loop more horrible than Pascal's repeat/until?
[...]
> > so code that has
> >
>
needs to do things in the current environment and
thus only part of the functionality can be moved away.
-Original Message-
From: Python-list On
Behalf Of Stefan Ram
Sent: Saturday, September 11, 2021 10:56 PM
To: python-list@python.org
Subject: Re: Friday Finking: Contorted loops
&quo
: Sunday, September 12, 2021 5:44 AM
To: python-list@python.org
Subject: Re: Friday Finking: Contorted loops
On 2021-09-11 21:38:02 -0400, Avi Gross via Python-list wrote:
> Peter, in your own personal finite sample, I am wondering what you
> might do TODAY if you looked at your loops aga
On 2021-09-11 at 18:21:17 +0100,
Alan Gauld via Python-list wrote:
> On 11/09/2021 15:41, Peter J. Holzer wrote:
>
> > How is C's do/while loop more horrible than Pascal's repeat/until?
>
> Because it is very hard to spot or distinguish from a normal
> while loop.
>
> while condition ;
>
> I
ss!
-Original Message-
From: Python-list On
Behalf Of Alan Gauld via Python-list
Sent: Saturday, September 11, 2021 3:59 AM
To: python-list@python.org
Subject: Re: Friday Finking: Contorted loops
On 10/09/2021 19:49, Stefan Ram wrote:
Alan Gauld writes:
OK, That's a useful persp
On Sun, 12 Sep 2021 10:11:15 +0200, jak wrote:
> -- snip --
>>
>> An inconsistency that I have been able to notice is this:
>> someone suggests to remedy the absence of the do-while with:
>> while True:
>> ...
>> if condition:
>> break
>> the problem arises if the while has
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> Alan Gauld writes:
>>OK, That's a useful perspective that is at least consistent.
>>Unfortunately it's not how beginners perceive it
> ...
>
> Beginners perceive it the way it is explained to them by
> their teacher.
My life as a professor would
-- snip --
An inconsistency that I have been able to notice is this:
someone suggests to remedy the absence of the do-while with:
while True:
...
if condition:
break
the problem arises if the while has an else of its own because the break
not only blocks the while loop but
On 11/09/2021 15:41, Peter J. Holzer wrote:
> How is C's do/while loop more horrible than Pascal's repeat/until?
Because it is very hard to spot or distinguish from a normal
while loop.
while condition ;
Is a valid (and fairly common) loop in C
so code that has
do{
code
}
while condition;
L
On 2021-09-11 21:38:02 -0400, Avi Gross via Python-list wrote:
> Peter, in your own personal finite sample, I am wondering what you might do
> TODAY if you looked at your loops again and considered redoing them for an
> assortment of reasons ranging from using the code for teaching to efficiency
>
methods too like map/reduce or vectorized operations?
-Original Message-
From: Python-list On
Behalf Of Peter J. Holzer
Sent: Saturday, September 11, 2021 10:42 AM
To: python-list@python.org
Subject: Re: Friday Finking: Contorted loops
On 2021-09-10 12:26:24 +0100, Alan Gauld via Python
n
Behalf Of Alan Gauld via Python-list
Sent: Saturday, September 11, 2021 3:59 AM
To: python-list@python.org
Subject: Re: Friday Finking: Contorted loops
On 10/09/2021 19:49, Stefan Ram wrote:
> Alan Gauld writes:
>> OK, That's a useful perspective that is at least consistent.
>>
On 10/09/2021 19:49, Stefan Ram wrote:
> Alan Gauld writes:
>> OK, That's a useful perspective that is at least consistent.
>> Unfortunately it's not how beginners perceive it
> ...
>
> Beginners perceive it the way it is explained to them by
> their teacher.
I'm not sure that's true. Most
On 2021-09-10 12:26:24 +0100, Alan Gauld via Python-list wrote:
> On 10/09/2021 00:47, Terry Reedy wrote:
> > even one loop is guaranteed.) "do-while" or "repeat-until is even rarer
> > since fractional-loop include this as a special case.
>
> Is there any empirical evidence to support this?
> O
2qdxy4rzwzuui...@potatochowder.com writes:
> On 2021-09-10 at 15:08:19 -0600,
> Joe Pfeiffer wrote:
>
>> r...@zedat.fu-berlin.de (Stefan Ram) writes:
>
>> > The existence of statements like "break" renders
>> > proof techniques for loops (such as Hoare's) with
>> > their invariants and inf
On 9/10/2021 7:38 AM, Alan Gauld via Python-list wrote:
But python complicates this tenet still further by adding an else
clause to its loops. And complicating this still more is that these
else clauses have almost exactly opposite effects.
To the contrary...
if...else
executes the else part
On 2021-09-10 at 15:08:19 -0600,
Joe Pfeiffer wrote:
> r...@zedat.fu-berlin.de (Stefan Ram) writes:
> > The existence of statements like "break" renders
> > proof techniques for loops (such as Hoare's) with
> > their invariants and inference rules unapplicable.
>
> Also the reason to avo
thon-list@python.org
Subject: Re: Friday Finking: Contorted loops
On 10/09/21 11:47 am, Terry Reedy wrote:
> 2. It is rare useful. For loops are common. While loops are
> occasional (nearly an order of magnitude less common than for loops.
> Fractional loop constructs are rare.
I wou
over and over for "if" statements and perhaps
some kind of case/switch statement and while loops and so on, may be
parsimonious but ...
-Original Message-
From: Python-list On
Behalf Of Alan Gauld via Python-list
Sent: Friday, September 10, 2021 11:58 AM
To: python-list@pytho
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> r...@zedat.fu-berlin.de (Stefan Ram) writes:
>>can be misleading, because the "..." part can still contain
>>"break", "raise", "continue", and "return" statement. So one
>>better should always be on the watch when reading source code
>>of a language l
On 10/09/2021 16:36, MRAB wrote:
>> while...else...
>>
>> executes the else if the body of the loop does NOT get executed.
>>
>> for...else...
>>
>> executes the else iff ALL iterations of the for loop DO complete.
>>
> [snip]
>
> In both cases, it executes the 'else' part if it didn't break out
On 2021-09-10 12:38, Alan Gauld via Python-list wrote:
On 09/09/2021 22:36, dn via Python-list wrote:
Even in fairly modest Python constructs, we quickly repeal the one-in,
one-out philosophy because try...except operates by providing another
exit-path.
Exceptions are exceptional by their nat
On 10/09/2021 00:47, Terry Reedy wrote:
> even one loop is guaranteed.) "do-while" or "repeat-until is even rarer
> since fractional-loop include this as a special case.
Is there any empirical evidence to support this?
Or is it just a case of using the tools that are available?
In my experience
On 09/09/2021 22:36, dn via Python-list wrote:
> Even in fairly modest Python constructs, we quickly repeal the one-in,
> one-out philosophy because try...except operates by providing another
> exit-path.
Exceptions are exceptional by their nature (or should be!) As such
they can arguably be excu
On 10/09/21 11:47 am, Terry Reedy wrote:
2. It is rare useful. For loops are common. While loops are occasional
(nearly an order of magnitude less common than for loops. Fractional
loop constructs are rare.
I would say that fractional loops are more common than loops
which truly need to exe
On Thu, 09 Sep 2021 19:07:49 -0400, Dennis Lee Bieber
declaimed the following:
>On Fri, 10 Sep 2021 09:36:36 +1200, dn via Python-list
> declaimed the following:
Someone, please shoot me now...
>>This is a perennial question (one contributor calling it "immemorial"),
>>but there seem to
On 2021-09-09 at 22:33:16 +,
Stefan Ram wrote:
> One can think of a language where every loop is exited this
> way, the only loop construct would be
>
> loop
> ...
>
> and it would /always/ have to be exited via enclosed breaks.
I'm not quite sure what you mean by "one can," but
On Fri, 10 Sep 2021 09:36:36 +1200, dn via Python-list
declaimed the following:
>Why does Python not have a repeat-until loop construct?
>(or should that be 'modern programming languages'?)
>
I would suspect Python's indentation for block structure would be the
major hindrance. After all
On 9/9/2021 5:36 PM, dn via Python-list wrote:
Why does Python not have a repeat-until loop construct?
1. It is not needed. You covered that.
2. It is rare useful. For loops are common. While loops are occasional
(nearly an order of magnitude less common than for loops. Fractional
loop c
33 matches
Mail list logo