Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Truth has always been found to promote the best interests of mankind... -- Percy Bysshe Shelley


devel / comp.lang.python / Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

SubjectAuthor
o Re: Variable scope inside and outside functions - global statement being overridRoel Schroeven

1
Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: roel@roelschroeven.net (Roel Schroeven)
Newsgroups: comp.lang.python
Subject: Re: Variable scope inside and outside functions - global statement
being overridden by assignation unless preceded by reference
Date: Wed, 6 Mar 2024 19:28:29 +0100
Lines: 29
Message-ID: <mailman.55.1709749713.3452.python-list@python.org>
References: <aff560df-2f57-47d9-ad81-74c21960c21d@gmail.com>
<0ccad7a9-eaba-48e6-b972-d89e5a930c11@DancesWithMice.info>
<db322a1b-2d29-4b67-9d5c-3e8d8737c0f5@gmail.com>
<b0b253c4-5e9e-44a3-975a-11851009d52c@wichmann.us>
<cbaf27c2-d2cb-4de1-a1c0-02a9fc9bf252@gmail.com>
<2007e9a9-01e9-48fd-b060-56b9ac4db4c9@roelschroeven.net>
<4TqgDp5mGRznVGY@mail.python.org>
<78d2710e-ed8e-45fd-8268-5081f130cf8a@roelschroeven.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de IGbWk2vpiuj38ne/rLcWgQV8ONqHf7oniLOsyrHoyl2g==
Cancel-Lock: sha1:GQNL7qOlU5WOyHaYu9cBcke4On4= sha256:VsD4E8bn1Ug2kJuUN2lfPV7ZOcFV7MaYIGviCVZri2Y=
Return-Path: <roel@roelschroeven.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=roelschroeven.net header.i=@roelschroeven.net
header.b=McAw+Lm0; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'modules': 0.07; 'roel':
0.09; 'schroeven': 0.09; 'theory': 0.09; 'tutorial': 0.12;
'import': 0.15; 'possible,': 0.15; '"there': 0.16; "'import":
0.16; 'assuming': 0.16; 'received:10.202': 0.16;
'received:10.202.2': 0.16; 'received:10.202.2.47': 0.16;
'received:internal': 0.16; 'received:messagingengine.com': 0.16;
'restaurant': 0.16; 'schreef': 0.16; 'subject:being': 0.16;
'subject:reference': 0.16; 'wrote:': 0.16; 'python': 0.16;
'grant': 0.17; 'to:addr:python-list': 0.20; 'written': 0.22;
'code': 0.23; 'tutorials': 0.23; '(and': 0.25; 'anyone': 0.25;
'>>>': 0.28; 'header:User-Agent:1': 0.30; 'here,': 0.32; 'python-
list': 0.32; 'but': 0.32; 'there': 0.33; 'particular': 0.33;
'header:In-Reply-To:1': 0.34; 'people': 0.36; 'really': 0.37;
"it's": 0.37; 'this.': 0.37; 'way': 0.38; 'use': 0.39; 'learn':
0.40; 'something': 0.40; 'ever': 0.63; 'prevent': 0.67; 'exactly':
0.68; 'states': 0.80; 'keystrokes,': 0.84; 'saves': 0.84;
'subject: \n ': 0.84; 'received:103': 0.91; 'instantly': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
roelschroeven.net; h=cc:content-transfer-encoding:content-type
:content-type:date:date:from:from:in-reply-to:in-reply-to
:message-id:mime-version:references:reply-to:subject:subject:to
:to; s=fm3; t=1709749710; x=1709836110; bh=uwXw0kSZphQkh9ppxU94D
mdHAbJ3KCza9hAfNW36mjY=; b=McAw+Lm0KHmipUU015a3f1sdZxh5KY4cLmJyk
8hgAH5VO+AG/dm8i3LO8zVMXDNbKCTov1W7aOAr24AgMY/1ucjdZ6MkTkIBz5Vct
gDmRscCciDZW0DZGP3AqQ8ysXP5RjD7OEZ7bKopZvUDUVCV/YBOIJNOWk3JgSTxC
7VUwnCZD0/+dhxx9Y2zC0MrF3/LC1oxFHvXp+VEcXciX4PsNdGyrRnb2zAXKZUmD
JZYjCwL8Asd+fOHac9Y94KhJVNNwPM1eFSg38Sm9BIKllzA1Sf/Gnnd5WXVibbnM
QLCtUXcEw18OUrnmgnopOLU3NWzxKzIlbvzDJT+6y1EQlrQPQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:content-transfer-encoding:content-type
:content-type:date:date:feedback-id:feedback-id:from:from
:in-reply-to:in-reply-to:message-id:mime-version:references
:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709749710; x=
1709836110; bh=uwXw0kSZphQkh9ppxU94DmdHAbJ3KCza9hAfNW36mjY=; b=H
+/QT3LFiV79T4QN+43G9PetXFd0/MSY1eA+o2hcdhBB8soBhYx49TSMLa3IyXHDu
kwpzd9TGFb/oAmcSpMWAS8+r8LoXkgMCQB5lECnYORo16e66XhZb3lASjA34k3TC
/l0CL/uNN5BSvnRdhRt0tXO2ZEpgvSCWA8NXJsWgzMnY5hfd+UnwrHHZLxZtbsCm
IsqA9jZU0VGE8N12H1MgwtD/se/zG4vCoDbOUWPT0Xrs72R1al+dGvPVDGuaLJ0/
CvOi2/uy1kY/cdIGekNqwBkKkl4h/IW0r4oFOD0zjyyYyfsO3Qyb1A5xeVHmC1RF
g3hQ0uuHTwsxwr25JVNbA==
X-ME-Sender: <xms:zrXoZbif1YADM6klwtvnFU8lDBUFJ6nL4XCwmQShXKgECp8MQC2vkg>
<xme:zrXoZYBtCt6g-nBOImZM7ElC8GtUgLpv6snNyNVPcaVqmaQFlkF4Xq98isZjg-mQQ
OK1DQriqxb5>
X-ME-Received: <xmr:zrXoZbH3MdI2vkD6lgu0MoppY0vI1r8k-Z3x9y-gak51O_SXBmSW6xr1onwybR3obF0iMnrNbYfHvxEA1icjXvtpNZtYoj0>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledriedugddutdelucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
uceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfhuffvfhgjtgfgsehtje
ertddtvdejnecuhfhrohhmpeftohgvlhcuufgthhhrohgvvhgvnhcuoehrohgvlhesrhho
vghlshgthhhrohgvvhgvnhdrnhgvtheqnecuggftrfgrthhtvghrnhepteffgfffffehgf
egheejgeduiedtgfdtveeijeegledtkeekkeeiteefudegvdejnecuvehluhhsthgvrhfu
ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhovghlsehrohgvlhhstghhrh
hovghvvghnrdhnvght
X-ME-Proxy: <xmx:zrXoZYTo3n13pENJX1WFQfj70W0Nt9k78ADCcVYsJDnGCVBDsmQ8RA>
<xmx:zrXoZYxcw-pb-l8BX8VllXbnV5XyXfb3P0n1xKLZs4JU-8GjbEqheA>
<xmx:zrXoZe7LSrQhjALXXhmohzAyaanNPljENcSJSjs3mMbWn50FlfxHZw>
<xmx:zrXoZVoAkV6B2TYa2ouVtYDb8R-Ys17wA665M2AlLY4PxLagWHs_kw>
Feedback-ID: i8e5b41ae:Fastmail
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <4TqgDp5mGRznVGY@mail.python.org>
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: <78d2710e-ed8e-45fd-8268-5081f130cf8a@roelschroeven.net>
X-Mailman-Original-References: <aff560df-2f57-47d9-ad81-74c21960c21d@gmail.com>
<0ccad7a9-eaba-48e6-b972-d89e5a930c11@DancesWithMice.info>
<db322a1b-2d29-4b67-9d5c-3e8d8737c0f5@gmail.com>
<b0b253c4-5e9e-44a3-975a-11851009d52c@wichmann.us>
<cbaf27c2-d2cb-4de1-a1c0-02a9fc9bf252@gmail.com>
<2007e9a9-01e9-48fd-b060-56b9ac4db4c9@roelschroeven.net>
<4TqgDp5mGRznVGY@mail.python.org>
 by: Roel Schroeven - Wed, 6 Mar 2024 18:28 UTC

Grant Edwards via Python-list schreef op 6/03/2024 om 18:59:
> On 2024-03-06, Roel Schroeven via Python-list <python-list@python.org>
> wrote:
> > Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list:
> >> >>> from scoping2 import *
> >
> > [...]
> >
> > I would advice not to use 'import *', if at all possible, for
> multiple > reasons, one of which is to prevent problems like this.
>
> Unfortunately, many (most?) tutorials for particular modules (and even
> example code in the Python documentation itself) are all written
> assuming that you do "from <module> import *". It saves the tutorial
> write a few keystrokes, but causes untold trouble for people who learn
> incorrectly that "from <module> import *" is the proper way to do
> things.

I know ... it's really irritating.

--
"There is a theory which states that if ever anyone discovers exactly what the
Universe is for and why it is here, it will instantly disappear and be
replaced by something even more bizarre and inexplicable.
There is another theory which states that this has already happened."
-- Douglas Adams, The Restaurant at the End of the Universe

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor