changing Python code in the debugger
Since you can change the contents of regular classes the way you want at any time, there's no need to update references to objects: you just update class's __dict__
with new methods and other attributes.
The problem is with references to functions: you can't update a function without changing its identity. You can use proxy functions that always look up real functions by name, and you change real functions at any moment. Else, you plan your code so that it doesn't store function references for long; once a function is updated, it will soon be looked up by name, but old references passed somewhere will continue to execute for a bit longer.
Such patching would make sense on a long-running system when you want to upgrade it without serious downtime: you pause it for a moment to upgrade several classes and functions consistently and un-pause. AFAIK Erlang does its on-the-fly updates in a similar way.