Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Nature, to be commanded, must be obeyed. -- Francis Bacon


devel / comp.lang.python / Re: Friday Finking: Contorted loops

SubjectAuthor
o Re: Friday Finking: Contorted loopsAlan Gauld

1
Re: Friday Finking: Contorted loops

<mailman.709.1631464818.4164.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19546&group=comp.lang.python#19546

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.niel.me!aioe.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: alan.gauld@yahoo.co.uk (Alan Gauld)
Newsgroups: comp.lang.python
Subject: Re: Friday Finking: Contorted loops
Date: Sat, 11 Sep 2021 18:21:17 +0100
Lines: 50
Message-ID: <mailman.709.1631464818.4164.python-list@python.org>
References: <097bf31d-44e8-da35-df41-3834524716c9@DancesWithMice.info>
<she6e0$3bi$1@ciao.gmane.io> <shffd3$p0h$1@ciao.gmane.io>
<YTzAN/9aoKmr9O/P@hjp.at> <shioie$oag$1@ciao.gmane.io>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de hBL/4sTIPOCpYDO6XPy2LAx6PFJ4JxxDo+S7enpBZn4A==
Return-Path: <python-python-list@m.gmane-mx.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'fairly': 0.05; 'loop':
0.07; 'loops.': 0.07; 'infinite': 0.09; 'message-
id:@ciao.gmane.io': 0.09; 'received:ciao.gmane.io': 0.09;
'received:gmane.io': 0.09; 'received:list': 0.09; '15:41,': 0.16;
'cases,': 0.16; 'confusing.': 0.16; 'flickr': 0.16;
'from:addr:alan.gauld': 0.16; 'from:name:alan gauld': 0.16;
'handful': 0.16; 'holzer': 0.16; 'loops': 0.16; 'photo-blog':
0.16; 'received:116.202': 0.16; 'received:116.202.254': 0.16;
'received:116.202.254.214': 0.16; 'spot': 0.16; 'termination':
0.16; 'url-ip:79.170.44.132/32': 0.16; 'url-ip:79.170.44/24':
0.16; 'url-ip:79.170/16': 0.16; 'url-ip:79/8': 0.16; 'url:alan-g':
0.16; 'url:alan_gauld': 0.16; 'url:alangauldphotos': 0.16;
'wrote:': 0.16; 'url:amazon': 0.19; 'to:addr:python-list': 0.20;
"i've": 0.22; 'code': 0.23; '(and': 0.25; 'url-
ip:104.85.6.101/32': 0.26; 'url-ip:104.85.6/24': 0.26; 'old':
0.27; 'header:User-Agent:1': 0.30; 'program': 0.31; 'empty': 0.32;
"wouldn't": 0.32; 'but': 0.32; 'there': 0.33; 'header:In-Reply-
To:1': 0.34; 'author': 0.37; 'hard': 0.37; 'valid': 0.39; 'use':
0.39; 'alan': 0.40; 'learn': 0.40; 'miss': 0.62; 'follow': 0.62;
'received:116': 0.64; 'times.': 0.64; 'url-ip:13.249/16': 0.68;
'url:author': 0.69; 'site': 0.70; 'easy': 0.74; 'surprise': 0.76;
'url-ip:13.249.48/24': 0.81; 'comprehend': 0.84; 'horrible': 0.84
X-Injected-Via-Gmane: http://gmane.org/
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <YTzAN/9aoKmr9O/P@hjp.at>
Content-Language: en-GB
X-Mailman-Approved-At: Sun, 12 Sep 2021 12:40:17 -0400
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <shioie$oag$1@ciao.gmane.io>
X-Mailman-Original-References: <097bf31d-44e8-da35-df41-3834524716c9@DancesWithMice.info>
<she6e0$3bi$1@ciao.gmane.io> <shffd3$p0h$1@ciao.gmane.io>
<YTzAN/9aoKmr9O/P@hjp.at>
 by: Alan Gauld - Sat, 11 Sep 2021 17:21 UTC

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;

Looks, for non-trivial cases, like a lot of code followed
by an empty while loop.

The do is easy to miss and the while loop disguised as
a repeat termination is confusing.

repeat
code
until condition

Is far clearer to comprehend since there is no ambiguity.

> In an old collection of small C programs of mine I find:
>
> 35 regular for loops
> 28 while loops
> 2 infinite for loops
> 1 "infinite" for loop (i.e. it exits somewhere in the middle)
> 0 do/while loops.

That wouldn't surprise me, I've only used do/while in C
a handful of times. But in Pascal I use it regularly.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


devel / comp.lang.python / Re: Friday Finking: Contorted loops

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor