Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SomeClass:
- def __init__(self):
- self.target = 'world'
- def hello(self):
- print('hello {}'.format(self.target))
- some_instance = SomeClass()
- class ProxyClass(some_instance.__class__):
- def hello(self):
- print('hi {}'.format(self.target))
- some_instance.__class__ = ProxyClass
- some_instance.hello()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement