Deutsch English Français Italiano |
<mailman.65.1709916072.3452.python-list@python.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: Grant Edwards <grant.b.edwards@gmail.com> Newsgroups: comp.lang.python Subject: Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference Date: Fri, 8 Mar 2024 11:41:10 -0500 (EST) Lines: 20 Message-ID: <mailman.65.1709916072.3452.python-list@python.org> References: <bd2e0672-fc3e-4678-b212-04ab1f45c52c@gmail.com> <ZepEKCbZNelFasml@cskk.homeip.net> <4Trnb856LRznVF4@mail.python.org> <CAPTjJmqg4AwHpMLZqteK-qiRZwzDoUCLAFvYGku1X4H2f6b_RA@mail.gmail.com> <4TrsPL1jK7znV1q@mail.python.org> X-Trace: news.uni-berlin.de 0JTSpDmF+1iou4UM7fm6CAB/yli2WHlyHnz6uic0uB9Q== Cancel-Lock: sha1:tAkv8WfwMSC8pK10hGkLxwXWvOc= sha256:Dclg5+b+4arXzPeIsA7Pd+9Q+zkkQ70tPfRxh62dgkk= Return-Path: <grant.b.edwards@gmail.com> 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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'mar': 0.07; 'space,': 0.07; 'angelico': 0.09; 'binding': 0.09; '2024': 0.16; 'bindings': 0.16; 'from:addr:grant.b.edwards': 0.16; 'from:name:grant edwards': 0.16; 'question,': 0.16; 'subject:being': 0.16; 'subject:reference': 0.16; 'wrote:': 0.16; 'grant': 0.17; 'probably': 0.17; "aren't": 0.19; 'name.': 0.19; 'to:addr:python- list': 0.20; 'sat,': 0.22; "isn't": 0.27; 'else': 0.27; 'chris': 0.28; 'sense': 0.28; 'computer': 0.29; 'header:User-Agent:1': 0.30; 'program': 0.31; "doesn't": 0.32; 'python-list': 0.32; 'but': 0.32; 'there': 0.33; 'same': 0.34; 'running': 0.34; 'from:addr:gmail.com': 0.35; 'source': 0.36; "it's": 0.37; 'single': 0.39; 'limited': 0.62; 'message-id:invalid': 0.68; 'within': 0.69; 'global': 0.73; 'bias': 0.76; 'choice': 0.76; 'left': 0.83; 'global.': 0.84; 'scope': 0.84; 'subject: \n ': 0.84 User-Agent: slrn/1.0.3 (Linux) 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: <4TrsPL1jK7znV1q@mail.python.org> X-Mailman-Original-References: <bd2e0672-fc3e-4678-b212-04ab1f45c52c@gmail.com> <ZepEKCbZNelFasml@cskk.homeip.net> <4Trnb856LRznVF4@mail.python.org> <CAPTjJmqg4AwHpMLZqteK-qiRZwzDoUCLAFvYGku1X4H2f6b_RA@mail.gmail.com> Bytes: 3964 On 2024-03-08, Chris Angelico via Python-list <python-list@python.org> wrote: > On Sat, 9 Mar 2024 at 00:51, Grant Edwards via Python-list ><python-list@python.org> wrote: > >> One might argue that "global" isn't a good choice for what to call the >> scope in question, since it's not global. It's limited to that source >> file. It doesn't make sense to me to call a binding "global", when >> there can be multile different "global" bindings of the same name. > > Most "globals" aren't global either, since you can have different > globals in different running applications. To me, "global" has always been limited to within a single process/address space, but that's probably just bias left over from C/Pascal/FORTRAN/assembly/etc. It never occurred to me that a global called "X" in one program on one computer would be the same as a global called "X" in a different program on a different computer somewhere else on the "globe".