Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-26 Thread Barry Warsaw
On Aug 26, 2017, at 12:43, francismb wrote: > >>> I propose RaymondLuxuryYach_t, but we’ll have to pronounce it >>> ThroatwobblerMangrove. >> >> Sorry, but I think we should prononce it ThroatwobblerMangrove. >> > too hard to pronounce but at least is unique, I would

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-26 Thread francismb
>> I propose RaymondLuxuryYach_t, but we’ll have to pronounce it >> ThroatwobblerMangrove. > > Sorry, but I think we should prononce it ThroatwobblerMangrove. > too hard to pronounce but at least is unique, I would prefer thredarena but I see naming is hard ... :-) Thanks! --francis

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Guido van Rossum
I think the issue with sys.std* is a distraction for this discussion. The issue also seems overstated, and I wouldn't want to change it. The ability to set these is mostly used in small programs that are also single-threaded. Libraries should never mess with them -- it's easy to explicitly pass an

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Eric Snow
On Fri, Aug 25, 2017 at 9:10 AM, Barry Warsaw wrote: > It’s ideas like this that do make me think of scopes when talking about > global state and execution contexts. I understand that the current PEP 550 > invokes an explicit separate namespace, Right. The observation that

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Yury Selivanov
On Fri, Aug 25, 2017 at 11:10 AM, Barry Warsaw wrote: [..] > It’s ideas like this that do make me think of scopes when talking about > global state and execution contexts. I understand that the current PEP 550 > invokes an explicit separate namespace, but thinking bigger, if

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Eric Snow
On Fri, Aug 25, 2017 at 8:18 AM, Yury Selivanov wrote: > Another idea: > > 1. We alter PyModule to make it possible to add properties (descriptor > protocol, or we implement custom __getattr__). I think we can make it > so that only sys module would be able to actually

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Barry Warsaw
On Aug 25, 2017, at 10:18, Yury Selivanov wrote: > > I has a similar idea when I discovered that PEP 550 can't be used > directly to fix sys.std* streams redirection. Another idea: > > 1. We alter PyModule to make it possible to add properties (descriptor > protocol,

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Yury Selivanov
Right, Nick, I missed the part that you want to have a file-like wrapper stored in sys.std* streams that would redirect lookups/calls to the relevant real file-object in the current context (correct?) I has a similar idea when I discovered that PEP 550 can't be used directly to fix sys.std*

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Nick Coghlan
On 25 August 2017 at 23:36, Yury Selivanov wrote: > On Fri, Aug 25, 2017 at 9:23 AM, Nick Coghlan wrote: > [..] >> And while PEP 550 doesn't handle the stream redirection case natively >> (since it doesn't allow for suspend/resume callbacks the way

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Yury Selivanov
On Fri, Aug 25, 2017 at 9:23 AM, Nick Coghlan wrote: [..] > And while PEP 550 doesn't handle the stream redirection case natively > (since it doesn't allow for suspend/resume callbacks the way PEP 525 > does), it at least allows for the development of a context-aware > output

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Nick Coghlan
On 25 August 2017 at 20:28, Antoine Pitrou wrote: > On Fri, 25 Aug 2017 15:36:55 +1000 > Nick Coghlan wrote: >> On 24 August 2017 at 23:52, Barry Warsaw wrote: >> > Guido van Rossum wrote: >> >> On Tue, Aug 22, 2017 at 7:12 PM,

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-25 Thread Antoine Pitrou
On Fri, 25 Aug 2017 15:36:55 +1000 Nick Coghlan wrote: > On 24 August 2017 at 23:52, Barry Warsaw wrote: > > Guido van Rossum wrote: > >> On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith wrote: > >> > >> I worry that that's going to lead

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Nick Coghlan
On 24 August 2017 at 23:52, Barry Warsaw wrote: > Guido van Rossum wrote: >> On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith wrote: >> >> I worry that that's going to lead more people astray thinking this has >> something to do with contextlib, which it really

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Greg Ewing
Barry Warsaw wrote: I actually think Python’s scoping rules are fairly easy to grasp, The problem is that the word "scope", as generally used in relation to programming languages, has to do with visibility of names. A variable is "in scope" at a particular point in the code if you can acccess

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Greg Ewing
Barry Warsaw wrote: This is my problem with using "Context" for this PEP. Although I can't keep up with all names being thrown around, Not sure whether it helps, but a similar concept in some Scheme dialects is called a "fluid binding". e.g. Section 5.4 of

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Antoine Pitrou
On Thu, 24 Aug 2017 17:06:09 -0400 Barry Warsaw wrote: > On Aug 24, 2017, at 16:01, francismb wrote: > > On 08/24/2017 03:52 PM, Barry Warsaw wrote: > >> Guido van Rossum wrote: > >>> On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Barry Warsaw
On Aug 24, 2017, at 16:01, francismb wrote: > On 08/24/2017 03:52 PM, Barry Warsaw wrote: >> Guido van Rossum wrote: >>> On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith wrote: >>> >>> I worry that that's going to lead more people astray thinking this has >>>

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread francismb
Hi, On 08/24/2017 03:52 PM, Barry Warsaw wrote: > Guido van Rossum wrote: >> On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith wrote: >> >> I worry that that's going to lead more people astray thinking this has >> something to do with contextlib, which it really doesn't (it's much

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Eric Snow
On Thu, Aug 24, 2017 at 8:23 AM, Yury Selivanov wrote: > Contrary to scoping, the programmer is much less likely to deal with > Execution Context. How often do we use "threading.local()"? This is an important point. PEP 550 is targeting library authors, right? Most

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Eric Snow
On Thu, Aug 24, 2017 at 7:52 AM, Barry Warsaw wrote: > Guido van Rossum wrote: >> On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith wrote: >> >> I worry that that's going to lead more people astray thinking this has >> something to do with contextlib, which it

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Ethan Furman
On 08/24/2017 06:52 AM, Barry Warsaw wrote: To me, the functionality proposed in PEP 550 feels more like a "scope" than a "context". Unlike a lexical scope, it can't be inferred from the layout of the source code. It's more of a dynamic "execution scope" and the stacking of "local execution

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Yury Selivanov
On Thu, Aug 24, 2017 at 10:38 AM, Barry Warsaw wrote: [..] I'll snip the naming discussion for now, I'm really curious to see what other people will say. > A different tack would more closely align with PEP 550’s heritage in > thread-local storage, calling these things

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Paul Moore
On 24 August 2017 at 15:38, Barry Warsaw 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

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Barry Warsaw
On Aug 24, 2017, at 10:23, Yury Selivanov wrote: > > On Thu, Aug 24, 2017 at 9:52 AM, Barry Warsaw wrote: >> Guido van Rossum wrote: >>> On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith wrote: >>> >>> I worry that that's going to lead

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Yury Selivanov
On Thu, Aug 24, 2017 at 9:52 AM, Barry Warsaw wrote: > Guido van Rossum wrote: >> On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith wrote: >> >> I worry that that's going to lead more people astray thinking this has >> something to do with contextlib, which it

Re: [Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Antoine Pitrou
On Thu, 24 Aug 2017 09:52:47 -0400 Barry Warsaw wrote: > > To me, the functionality proposed in PEP 550 feels more like a "scope" > than a "context". I would call it "environment" myself, but that risks confusion with environment variables. Perhaps "dynamic environment" would

[Python-Dev] Scope, not context? (was Re: PEP 550 v3 naming)

2017-08-24 Thread Barry Warsaw
Guido van Rossum wrote: > On Tue, Aug 22, 2017 at 7:12 PM, Nathaniel Smith wrote: > > I worry that that's going to lead more people astray thinking this has > something to do with contextlib, which it really doesn't (it's much more > closely related to threading.local()). This