On 11 September 2017 at 00:52, Koos Zevenhoven <k7ho...@gmail.com> wrote:
> On Thu, Sep 7, 2017 at 9:26 PM, Eric Snow <ericsnowcurren...@gmail.com>
> wrote:
> [...]
>
>>
>> get_main():
>>
>>    Return the main interpreter.
>>
>
> I assume the concept of a main interpreter is inherited from the previous
> levels of support in the C API, but what exactly is the significance of
> being "the main interpreter"? Instead, could they just all be
> subinterpreters of the same Python process (or whatever the right wording
> would be)?

The main interpreter is ultimately responsible for the actual process
global state: standard streams, signal handlers, dynamically linked
libraries, __main__ module, etc.

The line between it and the "CPython Runtime" is fuzzy for both
practical and historical reasons, but the regular Python CLI will
always have a "first created, last destroyed" main interpreter, simply
because we don't really gain anything significant from eliminating it
as a concept.

By contrast, embedding applications that *don't* have a __main__
module, and already manage most process global state themselves
without the assistance of the CPython Runtime can already get pretty
close to just having a pool of peer subinterpreters, and will
presumably be able to get closer over time as the subinterpreter
support becomes more robust.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to