

I think you’re fundamentally misunderstanding the above.
In your first example, you change an attribute of an object. In your case you called it .value but could just as well have been called .jacket.
In the second case you replaced one immutable object with another. You didn’t change the “value” attribute of 1002 to 1001. You replaced the entire object, 1002 with a new one: 1001.
For anyone interested, I recently switched from using ty to Pyrefly and so far I’m very happy with the results. Mypy is more comprehensive, but painfully slow. ty delightfully fast, but lacking Django support is a deal-breaker.
Pyrefly mostly supports Django (unless you get creative with custom querysets) and for me, the trade-off is worth it for the performance.