Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
  2. Type "copyright", "credits" or "license()" for more information.
  3. >>> funcs = []
  4. >>> def decorator(function):
  5.     funcs.append(function)
  6.  
  7.    
  8. >>> @decorator
  9. def function(): print "function"
  10.  
  11. >>> function()
  12.  
  13. Traceback (most recent call last):
  14.   File "<pyshell#7>", line 1, in <module>
  15.     function()
  16. TypeError: 'NoneType' object is not callable
  17. >>> funcs[0]()
  18. function
  19. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement