Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-17 Thread Antoine Pitrou
On Tue, 12 Sep 2017 14:43:43 -0700 Eric Snow wrote: > On Sat, Sep 9, 2017 at 5:05 AM, Antoine Pitrou wrote: > > On Fri, 8 Sep 2017 16:04:27 -0700, Eric Snow > > wrote: > >> ``list()``:: > > > > It's called

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-12 Thread Guido van Rossum
On Tue, Sep 12, 2017 at 2:43 PM, Eric Snow wrote: > Yeah, in the first version of the PEP it was called "enumerate()". I > changed it to "list()" at Raymond's recommendation. The reasoning is > that it's less confusing to most people that way. TBH, I'd rather >

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-12 Thread Nick Coghlan
On 13 September 2017 at 07:43, Eric Snow wrote: > On Sat, Sep 9, 2017 at 5:05 AM, Antoine Pitrou wrote: >> On Fri, 8 Sep 2017 16:04:27 -0700, Eric Snow >> wrote: >>> ``list()``:: >> >> It's called ``enumerate()`` in

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-12 Thread Eric Snow
On Sat, Sep 9, 2017 at 11:04 AM, Nathaniel Smith wrote: > This phrase "bubble up" here is doing a lot of work :-). Can you elaborate > on what you mean? The text now makes it seem like the exception will just > pass from one interpreter into another, but that seems impossible

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-12 Thread Eric Snow
On Sat, Sep 9, 2017 at 5:05 AM, Antoine Pitrou wrote: > On Fri, 8 Sep 2017 16:04:27 -0700, Eric Snow > wrote: >> ``list()``:: > > It's called ``enumerate()`` in the threading module. Not sure there's > a point in choosing a different name here.

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-12 Thread Eric Snow
On Sat, Sep 9, 2017 at 4:45 AM, Antoine Pitrou wrote: > How does the other interpreter get the FIFO "tied" to it? > Is it `get_current().get_fifo(name)`? Something else? Yep, that's it. I've added some examples to the PEP to illustrate. That said, I'm re-working the method

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-12 Thread Eric Snow
On Fri, Sep 8, 2017 at 8:54 PM, Michel Desmoulin wrote: > Le 09/09/2017 à 01:28, Stefan Krah a écrit : >> Still, the argument "who uses subinterpreters?" of course still remains. > > For now, nobody. But if we expose it and web frameworks manage to create > workers as

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-12 Thread Eric Snow
On Sat, Sep 9, 2017 at 1:04 AM, Paul Moore wrote: > On 9 September 2017 at 00:04, Eric Snow wrote: >>add_recv_fifo(name=None): >>add_send_fifo(name=None): > > Personally, I *always* read these names backwards - from the POV of > the

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-12 Thread Eric Snow
On Fri, Sep 8, 2017 at 4:28 PM, Stefan Krah wrote: > The most promising model to me is to put *all* globals in a tls structure > and cache the whole structure. Extrapolating from my experiences with the > context, this might have a slowdown of "only" 4%. Yeah, this is

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-11 Thread Koos Zevenhoven
On Mon, Sep 11, 2017 at 8:51 AM, Nick Coghlan wrote: > On 10 September 2017 at 04:04, Nathaniel Smith wrote: > > On Sep 8, 2017 4:06 PM, "Eric Snow" wrote: > > > > > >run(code): > > > > Run the provided Python code in

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-10 Thread Nick Coghlan
On 10 September 2017 at 04:04, Nathaniel Smith wrote: > On Sep 8, 2017 4:06 PM, "Eric Snow" wrote: > > >run(code): > > Run the provided Python code in the interpreter, in the current > OS thread. If the interpreter is already running

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-10 Thread Nick Coghlan
On 10 September 2017 at 03:54, Nathaniel Smith wrote: > On Sep 9, 2017 9:07 AM, "Nick Coghlan" wrote: > > > To immediately realise some level of efficiency benefits from the > shared memory space between the main interpreter and subinterpreters, > I also think

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Nathaniel Smith
On Sep 8, 2017 4:06 PM, "Eric Snow" wrote: run(code): Run the provided Python code in the interpreter, in the current OS thread. If the interpreter is already running then raise RuntimeError in the interpreter that called ``run()``. The

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Nathaniel Smith
On Sep 9, 2017 9:07 AM, "Nick Coghlan" wrote: To immediately realise some level of efficiency benefits from the shared memory space between the main interpreter and subinterpreters, I also think these low level FIFOs should be defined as accepting any object that supports

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Nick Coghlan
On 9 September 2017 at 01:04, Paul Moore wrote: > On 9 September 2017 at 00:04, Eric Snow wrote: >>add_recv_fifo(name=None): >> >> Create a new FIFO, associate the two ends with the involved >> interpreters, and return the side

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Antoine Pitrou
On Fri, 8 Sep 2017 16:04:27 -0700 Eric Snow wrote: > > The module provides the following functions: > > ``list()``:: > >Return a list of all existing interpreters. It's called ``enumerate()`` in the threading module. Not sure there's a point in choosing a

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Antoine Pitrou
On Sat, 9 Sep 2017 09:04:59 +0100 Paul Moore wrote: > On 9 September 2017 at 00:04, Eric Snow wrote: > >add_recv_fifo(name=None): > > > > Create a new FIFO, associate the two ends with the involved > > interpreters, and return

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-09 Thread Paul Moore
On 9 September 2017 at 00:04, Eric Snow wrote: >add_recv_fifo(name=None): > > Create a new FIFO, associate the two ends with the involved > interpreters, and return the side associated with the interpreter > in which "add_recv_fifo()" was called.

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-08 Thread Nathaniel Smith
On Fri, Sep 8, 2017 at 8:54 PM, Michel Desmoulin wrote: > > Le 09/09/2017 à 01:28, Stefan Krah a écrit : >> Still, the argument "who uses subinterpreters?" of course still remains. > > For now, nobody. But if we expose it and web frameworks manage to create > workers as

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-08 Thread Michel Desmoulin
Le 09/09/2017 à 01:28, Stefan Krah a écrit : > On Fri, Sep 08, 2017 at 04:04:27PM -0700, Eric Snow wrote: >> * "stdlib support for subinterpreters adds extra burden >> on C extension authors" >> >> In the ``Interpreter Isolation`` section below we identify ways in >> which isolation in

Re: [Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-08 Thread Stefan Krah
On Fri, Sep 08, 2017 at 04:04:27PM -0700, Eric Snow wrote: > * "stdlib support for subinterpreters adds extra burden > on C extension authors" > > In the ``Interpreter Isolation`` section below we identify ways in > which isolation in CPython's subinterpreters is incomplete. Most > notable is

[Python-Dev] PEP 554 v2 (new "interpreters" module)

2017-09-08 Thread Eric Snow
I've updated the PEP in response to some excellent feedback. Thanks to all who helped. Most notably, I've added a basic object passing mechanism. I've included the PEP below. Please let me know what you think. Thanks! -eric PEP: 554