On Fri, Jun 18, 2021 at 12:43 AM Wes Turner <wes.turner@gmail.com> wrote:
>
> > What would be the advantage of such a declaration?
>
> Constants don't need to be locked or unlocked; which is advantageous for parallelism and reasoning about program correctness.
> True consts (wherein everything referred to in that object is 'frozen' and immutable or at least only modifiable with e.g. copy-on-write)
> wouldn't require locks,
> which would be post-GIL advantageous.
>
That only works if you have a garbage collector that doesn't depend on
reference counts (as CPython's does). Otherwise, you still need to
modify the object, in a trivial sense, every time a reference is added
or removed.
> Gilectomy is Larry Hastings’s project to attempt to remove the GIL from CPython. It a fork on CPython which uses lock per object rather than using a Global Interpreter Lock (GIL).
- There's probably a doc somewhere listing all of the post-GIL works? (Consts could be a helpful performance optimization for like all of the approaches I've seen)
> The PEP provides for a shared-nothing concurrency model. It has a minimal Python API in an interpreters module. It also adds channels to pass immutable objects between interpreters. A subinterpreter will retain its state, so the interpreter can be "primed" with modules and other setup in advance of its use.
ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/BZ5WQZP5BSJEO3FY2H4DK4RLDHZBOO3M/
Code of Conduct: http://python.org/psf/codeofconduct/