Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Science and religion are in full accord but science and faith are in complete discord.


devel / comp.lang.python / Re: Scope confusion in Python REPL

SubjectAuthor
o Re: Scope confusion in Python REPLAnssi Saari

1
Re: Scope confusion in Python REPL

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: as@sci.fi (Anssi Saari)
Newsgroups: comp.lang.python
Subject: Re: Scope confusion in Python REPL
Date: Thu, 13 Jan 2022 16:35:29 +0200
Organization: An impatient and LOUD arachnid
Lines: 13
Message-ID: <mailman.171.1642084532.3079.python-list@python.org>
References: <sm0y23kkkwu.fsf@lakka.kapsi.fi>
<CAPTjJmoFQuexLN1dyXwBqrb5RSUKZu3jFZtRPJ3sKvRKib1uPQ@mail.gmail.com>
<sm0tue71z66.fsf@lakka.kapsi.fi>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: news.uni-berlin.de hS2dSyRN08jigEk8MSvAjwYBAeCL9MCLXurW9VASk8MQ==
Return-Path: <as@sci.fi>
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.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'fairly': 0.05; 'matching':
0.07; 'angelico': 0.09; 'neat': 0.09; 'something,': 0.09;
'writes:': 0.09; 'subject:Python': 0.12; 'import': 0.15;
'"import': 0.16; 'confused': 0.16; 'context.': 0.16; 'to:addr
:python-list': 0.20; 'basically': 0.22; 'examples': 0.25;
'saying': 0.25; 'stuff': 0.25; 'anyone': 0.25; 'pattern': 0.26;
'local': 0.27; 'function': 0.27; 'chris': 0.28; 'header:User-
Agent:1': 0.30; 'header:Organization:1': 0.31; 'same,': 0.32;
'url:blog': 0.33; 'header:In-Reply-To:1': 0.34; 'thanks,': 0.36;
'still': 0.40; 'reference': 0.60; 'received:91': 0.62;
'interested.': 0.97
Mail-Followup-To: python-list@python.org
In-Reply-To: <CAPTjJmoFQuexLN1dyXwBqrb5RSUKZu3jFZtRPJ3sKvRKib1uPQ@mail.gmail.com>
(Chris Angelico's message of "Thu, 13 Jan 2022 23:27:26 +1100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
X-Rspam-Score: -3.1 (---)
X-Rspam-Report: Action: no action Symbol: RCVD_TLS_LAST(0.00)
Symbol: ARC_NA(0.00) Symbol: BAYES_HAM(-2.99)
Symbol: FROM_HAS_DN(0.00) Symbol: FREEMAIL_FROM(0.00)
Symbol: TO_MATCH_ENVRCPT_ALL(0.00) Symbol: MIME_GOOD(-0.10)
Symbol: TO_DN_NONE(0.00) Symbol: DMARC_NA(0.00)
Symbol: R_SPF_SOFTFAIL(0.00) Symbol: RCPT_COUNT_ONE(0.00)
Symbol: HAS_ORG_HEADER(0.00) Symbol: FROM_EQ_ENVFROM(0.00)
Symbol: R_DKIM_NA(0.00) Symbol: MIME_TRACE(0.00)
Symbol: ASN(0.00) Symbol: RCVD_COUNT_TWO(0.00)
Symbol: FREEMAIL_ENVFROM(0.00)
Message-ID: sm0tue71z66.fsf@lakka.kapsi.fi
X-SA-Exim-Connect-IP: 2001:67c:1be8::11
X-SA-Exim-Mail-From: as@sci.fi
X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false
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: <sm0tue71z66.fsf@lakka.kapsi.fi>
X-Mailman-Original-References: <sm0y23kkkwu.fsf@lakka.kapsi.fi>
<CAPTjJmoFQuexLN1dyXwBqrb5RSUKZu3jFZtRPJ3sKvRKib1uPQ@mail.gmail.com>
 by: Anssi Saari - Thu, 13 Jan 2022 14:35 UTC

Chris Angelico <rosuav@gmail.com> writes:

> When you import something, all you're doing is getting a local
> reference to it; "from foo import make_adder" is basically like saying
> "import foo; make_adder = foo.make_adder". The function itself is
> still the same, and it still remembers its original context.

Thanks, this clears it up.

The pattern matching examples that I was looking at when I got confused
are at
https://mathspp.com/blog/pydonts/pattern-matching-tutorial-for-pythonic-code
in case anyone is interested. Fairly neat stuff in my opinion.


devel / comp.lang.python / Re: Scope confusion in Python REPL

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor