Skip to content

Instantly share code, notes, and snippets.

@rahulkp220
Created June 26, 2016 15:19
Show Gist options
  • Save rahulkp220/d80a00b83a54c443ff5d5e3a75d1a1ad to your computer and use it in GitHub Desktop.
Save rahulkp220/d80a00b83a54c443ff5d5e3a75d1a1ad to your computer and use it in GitHub Desktop.
def duplicate(function):
def wrapper(*args,**kwargs):
return 2*function(*args,**kwargs)
return wrapper
def formatting(lowerscase = False):
def formatting_real(function):
def wrapper(*args, **kwargs):
if lowerscase:
return function(*args,**kwargs).lower()
else:
return function(*args,**kwargs).upper()
return wrapper
return formatting_real
@duplicate
@formatting(lowerscase = False)
def hello_world(msg = None):
return msg
print hello_world("Hi there!!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment