I\'ve read that it is possible to add a method to an existing object (i.e., not in the class definition) in Python.
I understand that it\'s not always good to do so
You can use lambda to bind a method to an instance:
def run(self): print self._instanceString class A(object): def __init__(self): self._instanceString = "This is instance string" a = A() a.run = lambda: run(a) a.run()
Output:
This is instance string