Advertisement
NickG

Untitled

Oct 18th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. class lolmyclass:
  2.     def __init__(self):
  3.         self.something = None
  4.  
  5. class heya:
  6.     def __init__(self):
  7.         self.lol = 5
  8.  
  9.     def set_some(self, an_obj):
  10.         setattr(an_obj, 'somefunc', self.some_func)
  11.  
  12.     def some_func(self):
  13.         print(self.lol)
  14.  
  15. mylol = lolmyclass()
  16. myheya = heya()
  17. myheya.set_some(mylol)
  18. mylol.somefunc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement