SHARE
TWEET

Untitled

a guest Jan 24th, 2020 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # BEGIN REGISTRATION
  2.  
  3. registry = []  # <1>
  4.  
  5.  
  6. class Dog:
  7.     def __call__(self, *args, **kwargs):
  8.         print('Qy')
  9.  
  10.  
  11. def register(func):  # <2>
  12.     print('running register(%s)' % func)  # <3>
  13.     registry.append(func)  # <4>
  14.     return Dog  # <5>
  15.  
  16.  
  17. @register  # <6>
  18. def f1():
  19.     print('running f1()')
  20.  
  21.  
  22. @register
  23. def f2():
  24.     print('running f2()')
  25.  
  26.  
  27. def f3():  # <7>
  28.     print('running f3()')
  29.  
  30.  
  31. def main():  # <8>
  32.     print('running main()')
  33.     print('registry ->', registry)
  34.     f1()
  35.     f2()
  36.     f3()
  37.  
  38.  
  39. if __name__ == '__main__':
  40.     main()  # <9>
  41.  
  42. # END REGISTRATION
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top