[Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming) (original) (raw)
Paul Moore p.f.moore at gmail.com
Thu Aug 24 10:56:24 EDT 2017
- Previous message (by thread): [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)
- Next message (by thread): [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 24 August 2017 at 15:38, Barry Warsaw <barry at python.org> wrote:
Yes, but in conversations about Python, the term “context” (in the context of context managers) comes up way more often than the term “scope”. I actually think Python’s scoping rules are fairly easy to grasp, as there aren’t that many levels or ways to access them, and the natural, common interactions are basically implicit when thinking about the code you’re writing.
So while “context”, “environment”, and “scope” are certainly overloaded terms in Python, the first two have very specific existing, commonplace constructs within Python, and “scope” is both the least overloaded of the three and most closely matches what is actually going on. A different tack would more closely align with PEP 550’s heritage in thread-local storage, calling these things “execution storage”. I think I read Guido suggest elsewhere using a namespace here so that in common code you’d only have to change the “threading.local()” call to migrate to PEP 550. It might be neat if you could do something like:
I strongly agree with Barry's reservations about using the term "context" here. I've not been following the discussion (I was away when it started and there's too many emails to go through to catch up) but I've found the use of the term "context" to be a particular problem in trying to understand what's going on just skimming the messages.
I don't have a strong opinion on what name should be used, but I am definitely against using the term "context".
Paul
- Previous message (by thread): [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)
- Next message (by thread): [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]