Last active
          May 21, 2018 19:33 
        
      - 
      
- 
        Save santosh/e33d77799f925b043eaabe414fdc0204 to your computer and use it in GitHub Desktop. 
    Procedurally learning the decorators.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def greeting(expr): | |
| def greeting_decorator(func): | |
| def function_wrapper(x): | |
| print(expr + ", " + func.__name__ + " returns:") | |
| func(x) | |
| return function_wrapper | |
| return greeting_decorator | |
| @greeting("καλημερα") | |
| def foo(x): | |
| print(42) | |
| foo("Hi") | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment