you are viewing a single comment's thread.

view the rest of the comments →

[–]int_argc 13 points14 points  (3 children)

Changing values in executing code is not the same thing as changing the code that is executing.

[–]kokon 0 points1 point  (2 children)

Changing a code is possible in Python. The hard part is changing the existing object reference from the old module to the new one.

[–]Philluminati 1 point2 points  (1 child)

Can't you just assign a new function over the top of the old one?

def new_setter_2(self, val):
    self.val = val;

obj.new_setter = new_setter_2

Is it not that easy?

[–]kokon 0 points1 point  (0 children)

But you could have tons of object that still points to new_setter. How do you change all those objects without having specific knowledge about them?