On Sat, 18 Dec 2021 08:40:57 -0000 "Jim J. Jewett" <jimjjew...@gmail.com> wrote: > Why are Immutability and transitive Immortality needed to share an object > across interpreters?
Immutability is a functional requirement: you don't want one interpreter to be able to change the state of another one by mistake. Unlike multi-threading, where shared mutable state is a feature, a multi-interpreter setup is defined by full semantic isolation between interpreters (even if some structures may technically be shared under the hood: e.g. process-wide immortal immutable objects). As for transitive immortality, it is just a necessary effect of immortality: if an object is immortal, by construction all the objects that it references will also be immortal. For example, if you decide that the tuple `("foo", "bar")` is immortal, then the "foo" and "bar" strings will also be *de facto* immortal, even if they are not explicitly marked as such. Regards Antoine. > > Are you assuming that a change in one interpreter should not be seen by > others? (Typical case, but not always true.) > > Or are you saying that there is a technical problem such that a change -- > even just to the reference count of a referenced string or something -- would > cause data corruption? (If so, could you explain why, or at least point me > in the general direction?) > > -jJ _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/MLEF2UKXKTOBI7HGUW37IYTW3POENRZF/ Code of Conduct: http://python.org/psf/codeofconduct/