[Python-Dev] [RELEASE] Python 2.7.14 release candidate 1

2017-08-26 Thread Benjamin Peterson
I'm happy to announce the immediate availability of Python 2.7.14 release candidate 1, a testing release for the latest bugfix release in the Python 2.7 series. Downloads of source code and binaries are at https://www.python.org/downloads/release/python-2714rc1/ Please consider testing the re

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Nathaniel Smith
On Sat, Aug 26, 2017 at 7:58 AM, Elvis Pranskevichus wrote: > On Saturday, August 26, 2017 2:34:29 AM EDT Nathaniel Smith wrote: >> On Fri, Aug 25, 2017 at 3:32 PM, Yury Selivanov > wrote: >> > Coroutines and Asynchronous Tasks >> > - >> > >> > In coroutines, like

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Nathaniel Smith
On Sat, Aug 26, 2017 at 10:25 AM, Eric Snow wrote: > With threads we have a directed graph of execution, rooted at the root > thread, branching with each new thread and merging with each .join(). > Each thread gets its own copy of each threading.local, regardless of > the relationship between bran

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Ethan Furman
On 08/26/2017 12:12 PM, David Mertz wrote: I'm convinced by the new section explaining why a single value is better than a namespace. Nonetheless, it would feel more "Pythonic" to me to create a property `ContextVariable.val` whose getter and setter was `.lookup()` and `.set()` (or maybe `._lo

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread francismb
Hi, > Multithreaded Code > -- > > In multithreaded code, context variables behave like thread locals:: > > var = new_context_var() > > def sub(): > assert var.lookup() is None # The execution context is empty > # for each ne

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Antoine Pitrou
On Sat, 26 Aug 2017 13:23:00 -0400 Yury Selivanov wrote: > > > > A good point; however, ChainMap, which behaves similarly as far as lookup > > goes, uses "get" and does not have a "lookup" method. I think we lose more > > than we gain by changing that method name. > > ChainMap is constrained t

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread francismb
Hi, > > For the purpose of this section, we define *execution context* as an > opaque container of non-local state that allows consistent access to > its contents in the concurrent execution environment. > May be nonsense/non-practical :-), but : - How extrapolates this concept to the whole in

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread David Mertz
I'm convinced by the new section explaining why a single value is better than a namespace. Nonetheless, it would feel more "Pythonic" to me to create a property `ContextVariable.val` whose getter and setter was `.lookup()` and `.set()` (or maybe `._lookup()` and `._set()`). Lookup might require a

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Sven R. Kunze
On 26.08.2017 19:23, Yury Selivanov wrote: ChainMap is constrained to be a Mapping-like object, but I get your point. Let's see what others say about the "lookup()". It is kind of an experiment to try a name and see if it fits. I like "get" more. ;-) Best, Sven PS: This might be a result o

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Barry Warsaw
On Aug 26, 2017, at 14:15, Yury Selivanov wrote: > > Elvis just added it: > https://www.python.org/dev/peps/pep-0550/#replication-of-threading-local-interface Thanks, that’s exactly what I was looking for. Great summary of the issue. > >> That said, if we have to use method lookup, then I agre

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
On Sat, Aug 26, 2017 at 12:30 PM, Barry Warsaw wrote: > I agree with David; this PEP has really gotten to a great place and the new > organization makes it much easier to understand. > >> On Aug 25, 2017, at 22:19, Ethan Furman wrote: >> >> Why "lookup" and not "get" ? Many APIs use "get" and i

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
Hi Eric, On Sat, Aug 26, 2017 at 1:25 PM, Eric Snow wrote: > Thanks for the update. Comments in-line below. > > -eric > > On Fri, Aug 25, 2017 at 4:32 PM, Yury Selivanov > wrote: >> [snip] >> >> This PEP adds a new generic mechanism of ensuring consistent access >> to non-local state in the co

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Eric Snow
On Sat, Aug 26, 2017 at 11:19 AM, Yury Selivanov wrote: > This is similar to namedtuples, and nobody really complains about them. FWIW, there are plenty of complaints on python-ideas about this (and never a satisfactory solution). :) That said, I don't think it is as big a deal here since the t

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Eric Snow
Thanks for the update. Comments in-line below. -eric On Fri, Aug 25, 2017 at 4:32 PM, Yury Selivanov wrote: > [snip] > > This PEP adds a new generic mechanism of ensuring consistent access > to non-local state in the context of out-of-order execution, such > as in Python generators and coroutin

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
On Sat, Aug 26, 2017 at 1:23 PM, Ethan Furman wrote: > On 08/26/2017 09:25 AM, Yury Selivanov wrote: >> >> On Fri, Aug 25, 2017 at 10:19 PM, Ethan Furman wrote: > > A *context variable* is an object representing a value in the execution context. A new context variable is created by call

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Ethan Furman
On 08/26/2017 09:25 AM, Yury Selivanov wrote: On Fri, Aug 25, 2017 at 10:19 PM, Ethan Furman wrote: A *context variable* is an object representing a value in the execution context. A new context variable is created by calling the ``new_context_var()`` function. A context variable object has

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
On Sat, Aug 26, 2017 at 1:10 PM, David Mertz wrote: > Would it be possible/desirable to make the default a unique string value > like a UUID or a stringified counter? Sure, or we could just use the id of ContextVar. In the end, when we want to introspect the EC while debugging, we would see some

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
On Sat, Aug 26, 2017 at 2:34 AM, Nathaniel Smith wrote: > On Fri, Aug 25, 2017 at 3:32 PM, Yury Selivanov > wrote: >> Coroutines and Asynchronous Tasks >> - >> >> In coroutines, like in generators, context variable changes are local >> and are not visible to the c

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread David Mertz
Would it be possible/desirable to make the default a unique string value like a UUID or a stringified counter? On Aug 26, 2017 9:35 AM, "Yury Selivanov" wrote: On Sat, Aug 26, 2017 at 12:56 AM, David Mertz wrote: > This is now looking really good and I can understands it. Great! > > One quest

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 prefer thredarena > but I

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] how to dump cst

2017-08-26 Thread Emily E Morehouse
Hi, I believe the parser module allows for generation of a CST, though the documentation is not specific about the type of syntax tree used. The old compiler module utilized it for this purpose and co

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
On Sat, Aug 26, 2017 at 12:56 AM, David Mertz wrote: > This is now looking really good and I can understands it. Great! > > One question though. Sometimes creation of a context variable is done with a > name argument, other times not. E.g. > > var1 = new_context_var('var1') > var = new_conte

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
On Sat, Aug 26, 2017 at 9:33 AM, Sven R. Kunze wrote: [..] > Why not the same interface as thread-local storage? This has been the > question which bothered me from the beginning of PEP550. I don't understand > what inventing a new way of access buys us here. This was covered at length in these t

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Barry Warsaw
I agree with David; this PEP has really gotten to a great place and the new organization makes it much easier to understand. > On Aug 25, 2017, at 22:19, Ethan Furman wrote: > > Why "lookup" and not "get" ? Many APIs use "get" and it's functionality is > well understood. I have the same ques

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
On Sat, Aug 26, 2017 at 6:22 AM, Stefan Behnel wrote: > Hi, > > I'm aware that the current implementation is not final, but I already > adapted the coroutine changes for Cython to allow for some initial > integration testing with real external (i.e. non-Python coroutine) targets. > I haven't adapt

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Yury Selivanov
On Fri, Aug 25, 2017 at 10:19 PM, Ethan Furman wrote: > All in all, I like it. Nice job. Thanks! > > On 08/25/2017 03:32 PM, Yury Selivanov wrote: > >> A *context variable* is an object representing a value in the >> execution context. A new context variable is created by calling >> the ``new_

Re: [Python-Dev] PEP 550 v4: Decimal examples and performance (was: Re: PEP 550 v4)

2017-08-26 Thread Yury Selivanov
On Sat, Aug 26, 2017 at 7:45 AM, Stefan Krah wrote: > > Hi, > > thanks, on the whole this is *much* easier to understand. Thanks! > I'll add some comments on the decimal examples. The thing is, decimal > is already quite tricky and people do read PEPs long after they have > been accepted, so the

[Python-Dev] PEP 550 v4: Decimal examples and performance (was: Re: PEP 550 v4)

2017-08-26 Thread Stefan Krah
Hi, thanks, on the whole this is *much* easier to understand. I'll add some comments on the decimal examples. The thing is, decimal is already quite tricky and people do read PEPs long after they have been accepted, so they should probably reflect best practices. On Fri, Aug 25, 2017 at 06:32:

[Python-Dev] how to dump cst

2017-08-26 Thread yang chen
Hello, everyone. I'm learning python source code, I used to print info when I debug code, but it's not convenient. I want to print CST, AST, ByteCode with iPython, wirte some code, then print it's CST、AST、 BYTECODE, and then to read the source code. But, I can't dump the CST tree which will tran

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Elvis Pranskevichus
On Saturday, August 26, 2017 2:34:29 AM EDT Nathaniel Smith wrote: > On Fri, Aug 25, 2017 at 3:32 PM, Yury Selivanov wrote: > > Coroutines and Asynchronous Tasks > > - > > > > In coroutines, like in generators, context variable changes are > > local> > > and are

[Python-Dev] PEP 442 undocumented C API functions

2017-08-26 Thread Pauli Virtanen
Hi, PEP 442 says "Two new C API functions are provided to ease calling of tp_finalize, especially from custom deallocators." This includes PyObject_CallFinalizerFromDealloc. However, no documentation of these functions appears to exist (https://bugs.python. org/issue31276). As far as I understan

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Sven R. Kunze
On 26.08.2017 04:19, Ethan Furman wrote: On 08/25/2017 03:32 PM, Yury Selivanov wrote: A *context variable* is an object representing a value in the execution context. A new context variable is created by calling the ``new_context_var()`` function. A context variable object has two methods:

Re: [Python-Dev] PEP 550 v4

2017-08-26 Thread Stefan Behnel
Hi, I'm aware that the current implementation is not final, but I already adapted the coroutine changes for Cython to allow for some initial integration testing with real external (i.e. non-Python coroutine) targets. I haven't adapted the tests yet, so the changes are currently unused and mostly u