# PEP 795: Add deep immutability to Python

**URL:** <https://discuss.python.org/t/pep-795-add-deep-immutability-to-python/96014>\
**Category:** PEPs\
**Created:** [June 19, 2025, 9:42am UTC](https://discuss.python.org/t/pep-795-add-deep-immutability-to-python/96014 "2025-06-19T09:42:40Z")\
**Posts on this page:** 1\
**Showing post:** 63

<div class="post-metadata">

**Author:** ![mjp41](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/mjp41/32/27482_2.png) [@mjp41](https://discuss.python.org/u/mjp41)\
**Post date:** [July 2, 2025, 2:23pm UTC](https://discuss.python.org/t/pep-795-add-deep-immutability-to-python/96014/63 "2025-07-02T14:23:19Z")

</div>

> [@steve.dower](#):
>
> Was there any discussion of an immutable proxy alternative? I see it’s not mentioned in the rejected section.

We will add a section about this. We couldn’t see how to make this work in a safe way with sub-interpreters.

> [@ZeroIntensity](#):
>
> Yeah, I think this is a much more robust approach, because the wrapped object doesn’t even have to be immutable, or follow strict `Py_CHECKWRITE` contracts. Immutability is nice sometimes, but you still generally want _some_ shared data between threads. Several months ago, I threw together a [POC](https://github.com/ZeroIntensity/cpython/tree/shared-object-proxy) for this exact idea with subinterpreters via an immortal object proxy. There are definitely some issues with it, but I think this PEP doing something similar would play better with the ecosystem (particularly because you wouldn’t need to modify every C type out there).

We have been looking at your example on discussion on [Gauging interest in arbitrary object immortalization and shared object proxies](https://discuss.python.org/t/gauging-interest-in-arbitrary-object-immortalization-and-shared-object-proxies/97306).

I am bit unsure about two things

- Are calls to `SharedObjectProxy`s asynchronous, or synchronous? If synchronous is there a possiblity of deadlock?
- Are the parameters passed to a method on a `SharedObjectProxy` also proxied? If not, can that lead to sharing?

@ZeroIntensity should I post these questions on the other discussion (not sure on the etiquette of overlapping conversions on DPO)?

---

_[View the full topic](https://discuss.python.org/t/pep-795-add-deep-immutability-to-python/96014)._
