On Fri, Jun 18, 2021 at 12:43 AM Wes Turner <wes.tur...@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.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@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/

Reply via email to