Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

HELP!!!! I'm being held prisoner in /usr/games/lib!


devel / comp.lang.python / Re: Behavior of the for-else construct

SubjectAuthor
o Re: Behavior of the for-else constructCameron Simpson

1
Re: Behavior of the for-else construct

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs...@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: Behavior of the for-else construct
Date: Sat, 5 Mar 2022 12:15:28 +1100
Lines: 20
Message-ID: <mailman.184.1646444922.2329.python-list@python.org>
References: <CALq4Z0-fJk-HOu0ka2kPrOioPYAh3e3zbziwetUDmAAx1U1LMw@mail.gmail.com>
<YiK5sBXLrgwFFA+N@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.uni-berlin.de 3n+nxc8u8/LBP+vosd6PGwb2joUnHhLI5v4HkyAXTsTw==
Return-Path: <cameron@cskk.id.au>
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.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python?': 0.03; '(which':
0.04; 'variable': 0.05; 'loop': 0.07; 'construct': 0.09;
'indeed.': 0.09; 'cheers,': 0.11; 'branches,': 0.16; 'cameron':
0.16; 'flag': 0.16; 'from:addr:cs': 0.16; 'from:addr:cskk.id.au':
0.16; 'from:name:cameron simpson': 0.16; 'message-
id:@cskk.homeip.net': 0.16; 'received:10.10': 0.16; 'simpson':
0.16; 'subject:else': 0.16; 'wrote:': 0.16; 'python': 0.16;
'to:addr:python-list': 0.20; 'run': 0.23; '(and': 0.25; 'bit':
0.27; 'recently': 0.29; 'it,': 0.29; 'header:User-Agent:1': 0.30;
'but': 0.32; 'subject:for': 0.33; 'there': 0.33; 'header:In-Reply-
To:1': 0.34; 'special': 0.37; 'quite': 0.39; 'use': 0.39; 'much.':
0.39; 'seeing': 0.39; 'both': 0.40; 'want': 0.40; 'here.': 0.61;
'finally': 0.62; 'years': 0.65; 'wish': 0.66; 'received:userid':
0.66; 'header:Received:6': 0.67; 'times': 0.69; 'survey': 0.71;
'little': 0.73; 'head': 0.73; 'received:119': 0.84
X-RG-Spam: Unknown
X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvvddruddtledgvdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuuffpveftpgfvgffnuffvtfetpdfqfgfvnecuuegrihhlohhuthemucegtddtnecunecujfgurhepfffhvffukfggtggujggffhesthdtredttdervdenucfhrhhomhepvegrmhgvrhhonhcuufhimhhpshhonhcuoegtshestghskhhkrdhiugdrrghuqeenucggtffrrghtthgvrhhnpeelveefgefhgefgheduvdfghefhffejgedvueeihfegleegkeefffeigfdutdevheenucfkphepudduledruddvrddvudekrdduleefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghlohepsghorhhgrdgtshhkkhdrhhhomhgvihhprdhnvghtpdhinhgvthepudduledruddvrddvudekrdduleefpdhmrghilhhfrhhomheptggrmhgvrhhonhestghskhhkrdhiugdrrghupdhnsggprhgtphhtthhopedvpdhrtghpthhtoheptghssegtshhkkhdrihgurdgruhdprhgtphhtthhopehphihthhhonhdqlhhishhtsehphihthhhonhdrohhrgh
X-RazorGate-Vade-Verdict: clean 0
X-RazorGate-Vade-Classification: clean
X-RG-VS-CLASS: clean
X-Authentication-Info: Submitted using ID cskk@bigpond.com
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <CALq4Z0-fJk-HOu0ka2kPrOioPYAh3e3zbziwetUDmAAx1U1LMw@mail.gmail.com>
User-Agent: Mutt/2.2.1 (2022-02-19)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <YiK5sBXLrgwFFA+N@cskk.homeip.net>
X-Mailman-Original-References: <CALq4Z0-fJk-HOu0ka2kPrOioPYAh3e3zbziwetUDmAAx1U1LMw@mail.gmail.com>
 by: Cameron Simpson - Sat, 5 Mar 2022 01:15 UTC

On 03Mar2022 14:24, computermaster360 <computermaster360@gmail.com> wrote:
>I want to make a little survey here.
>
>Do you find the for-else construct useful? Have you used it in
>practice? Do you even know how it works, or that there is such a thing
>in Python?

I used Python for years before understanding the for-else (and
therefore, without seeing a use for it). Finally made the time to wrap
my head around it quite recently and have used it a few times since.

It is a little niche, but when you want it, it is very nice indeed.
Certainly avoids managing a special flag variable (which can be fiddly
and therefore fragile) for "did my loop not run to completion"?

I sort of wish it had both "used break" and "did not use break"
branches, a bit like try/except/else. But not very much.

Cheers,
Cameron Simpson <cs@cskk.id.au>

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor