Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class WrapExample(object):
- def __init__(self, arg):
- def _wrapper(self):
- return self.wrapper(self, arg)
- self.wrap_me = _wrapper
- def wrap_me(self):
- pass
- def wrapper(self, arg):
- print arg
- def main():
- s = WrapExample('hello')
- s.wrap_me()
- if __name__ == '__main__':
- main()
- """
- when ran, the program outputs the following exception:
- Traceback (most recent call last):
- File "t.py", line 18, in <module>
- main()
- File "t.py", line 15, in main
- s.wrap_me()
- TypeError: _wrapper() takes exactly 1 argument (0 given)
- Is there a way to wrap a method ?
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement