[Python-ideas] PEP 554: Stdlib Module to Support Multiple Interpreters in Python Code

Koos Zevenhoven k7hoven at gmail.com
Tue Sep 12 11:33:01 EDT 2017


On Tue, Sep 12, 2017 at 6:30 PM, Koos Zevenhoven <k7hoven at gmail.com> wrote:

> On Tue, Sep 12, 2017 at 5:53 PM, Stefan Krah <stefan at bytereef.org> wrote:
>
>> On Tue, Sep 12, 2017 at 05:35:34PM +0300, Koos Zevenhoven wrote:
>> > I don't see how the situation benefits from calling something the "main
>> > interpreter". Subinterpreters can be a way to take something
>> > non-thread-safe and make it thread-safe, because in an
>> > interpreter-per-thread scheme, most of the state, like module globals,
>> are
>> > thread-local. (Well, this doesn't help for async concurrency, but
>> anyway.)
>>
>> You could have a privileged C extension that is only imported in the main
>> interpreter:
>>
>>
>> if get_current_interp() is main_interp():
>>     from _decimal import *
>> else:
>>     from _pydecimal import *
>>
>>
>>
>
​​Oops.. it should of course be "by_this_process", not "by_other_process"
(fixed below).​​



> ​Or it could be first-come first-served:
>
> if is_imported_by_
> ​this
> _process("_decimal"):
> ​​
>
>
    from _pydecimal import *
> else
>     from _decimal import *
>
> ––Koos
>
>
>
> --
> + Koos Zevenhoven + http://twitter.com/k7hoven +
>



-- 
+ Koos Zevenhoven + http://twitter.com/k7hoven +
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170912/c33e61c9/attachment-0001.html>


More information about the Python-ideas mailing list