Skip to content

Instantly share code, notes, and snippets.

@vinay13
Created August 21, 2016 21:16
Show Gist options
  • Save vinay13/537847490358bfaf9163c49e2b179b40 to your computer and use it in GitHub Desktop.
Save vinay13/537847490358bfaf9163c49e2b179b40 to your computer and use it in GitHub Desktop.
#usr/bin/python
#Decorators
def decorator_func(original_function):
def wrapper_func():
print('wrapper executed this before {}'.format(original_function.__name__))
return original_function()
return wrapper_func
@decorator_func
def display():
print('display function ran')
@decorator_func
def xyz_display():
print('xyz display ran')
print dir(decorator_func)
display()
xyz_display()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment