Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Ada is PL/I trying to be Smalltalk. -- Codoso diBlini


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

SubjectAuthor
o Re: Behavior of the for-else constructDieter Maurer

1
Re: Behavior of the for-else construct

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: dieter@handshake.de (Dieter Maurer)
Newsgroups: comp.lang.python
Subject: Re: Behavior of the for-else construct
Date: Fri, 4 Mar 2022 18:08:42 +0100
Lines: 17
Message-ID: <mailman.163.1646413726.2329.python-list@python.org>
References: <CALq4Z0-fJk-HOu0ka2kPrOioPYAh3e3zbziwetUDmAAx1U1LMw@mail.gmail.com>
<YiFCPlGC+2aRIR0K@shallowsky.com>
<21739669.459456.1646348879560@mail.yahoo.com>
<e3544242-cd54-05d3-2101-5b9fedc1c13e@btinternet.com>
<25121.48093.26762.592197@ixdm.fritz.box>
<1277767760.379444.1646412189311@mail.yahoo.com>
<25122.18330.429979.400137@ixdm.fritz.box>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de TNqvoxtkmRVSXzanrNCB5QKpveTusWdSbQjfc/TE3ffg==
Return-Path: <dieter@handshake.de>
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.025
X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'variable': 0.05; 'loop':
0.07; 'cc:addr:python-list': 0.09; 'something,': 0.09; 'avi':
0.16; 'gross': 0.16; 'subject:else': 0.16; 'cc:addr:python.org':
0.20; 'cc:2**1': 0.23; 'received:de': 0.23; 'purpose': 0.28;
'subject:for': 0.33; 'same': 0.34; 'header:In-Reply-To:1': 0.34;
'main': 0.37; 'use': 0.39; 'wrote': 0.39; 'your': 0.64;
'header:Received:6': 0.67; 'received:88': 0.84; 'thing?': 0.84
In-Reply-To: <1277767760.379444.1646412189311@mail.yahoo.com>
X-Mailer: VM 8.0.12-devo-585 under 21.4 (patch 24) "Standard C" XEmacs Lucid
(x86_64-linux-gnu)
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: <25122.18330.429979.400137@ixdm.fritz.box>
X-Mailman-Original-References: <CALq4Z0-fJk-HOu0ka2kPrOioPYAh3e3zbziwetUDmAAx1U1LMw@mail.gmail.com>
<YiFCPlGC+2aRIR0K@shallowsky.com>
<21739669.459456.1646348879560@mail.yahoo.com>
<e3544242-cd54-05d3-2101-5b9fedc1c13e@btinternet.com>
<25121.48093.26762.592197@ixdm.fritz.box>
<1277767760.379444.1646412189311@mail.yahoo.com>
 by: Dieter Maurer - Fri, 4 Mar 2022 17:08 UTC

Avi Gross wrote at 2022-3-4 16:43 +0000:
>Your use is creative albeit it is not "needed" since all it does is make sure your variable is initialized to something, specifically None.
>
>So would this not do the same thing?
>
> eye = None
>
> for eye in range(0):
> print(eye)
>
> eye

It would.

But, the `for` construct's main purpose is often to determine
a value for the loop variable and in this case, I like
that it itself can ensure that it gets a value.


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

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor