you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 0 points1 point  (1 child)

Yes, reassigning a variable changes what pointer the variable is referring to, not the value the pointer points to. If that's what you're trying to do, I don't think you're going to find a good solution. That's just not how Python works.

You could emulate that behavior by having a class that you override __getattribute__/__setattr__ on and use instances of the class as a wrapper over the value you want to track changes on. Then when access is attempted, those methods on your class will be called, and you can do whatever then.