I had asked this question before. capture change of global variable value in python
But there is a small issue. When I extend the str class and apply an observer then a setter method invoke works but when I try to reassign a new value to the same variable name then observer is not called.
How to trigger function on value change?
let's say I have an assignment and reassignment as below:
car = 10
print(10)
car = 20
print(20)
When the variable car is reassigned, any kind of observer is not invoked. Any way I can observe the reassignment or assignment operator. I don't mind working with the AST module. Trace from inspect debugger can slow things up is what I have read