# Adding Deep Immutability

**URL:** <https://discuss.python.org/t/adding-deep-immutability/92011>\
**Category:** Ideas\
**Created:** [May 14, 2025, 9:27pm UTC](https://discuss.python.org/t/adding-deep-immutability/92011 "2025-05-14T21:27:34Z")\
**Posts on this page:** 1\
**Showing post:** 31

<div class="post-metadata">

**Author:** ![MegaIng](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/megaing/32/16162_2.png) [@MegaIng](https://discuss.python.org/u/MegaIng)\
**Post date:** [May 19, 2025, 2:23pm UTC](https://discuss.python.org/t/adding-deep-immutability/92011/31 "2025-05-19T14:23:23Z")

</div>

I find the fundamental approach here a bit worrying. Frozen and non-frozen objects should be distinct types. The following code should not be able to fail for any reason except out-of-memory IMO:

```python
if isinstance(l, list):
    l.append(1)

```

Changing this invariant is such a fundamental change in the mental model programmers need to have that it IMO requires equally fundamental justifications, if it can ever happen. I have not seen any such justifications yet. In rust, every _variable_ has tracked mutability states - this is not what is being added in this PEP, what is being added is every _object_ having a tracked mutability state.

---

_[View the full topic](https://discuss.python.org/t/adding-deep-immutability/92011)._
