
June 17, 2021
2:49 p.m.
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. ChrisA