Guest User

Untitled

a guest
Feb 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. class Foo(object):
  2. def __init__(self,arg):
  3. """docstring for __init__"""
  4. self.arg = arg
  5.  
  6. def dec(fn):
  7. def wrapper(*args):
  8. # args[0] is self. Lame
  9. args[0].arg = 'not what you thought, huh?'
  10. return fn(*args)
  11. return wrapper
  12.  
  13.  
  14. @dec
  15. def bar(self):
  16. """docstring for bar"""
  17. return self.arg
Add Comment
Please, Sign In to add comment