Skip to content

Instantly share code, notes, and snippets.

@tsyber1an
Created October 15, 2015 11:27
Show Gist options
  • Save tsyber1an/f8667079bd863623aa9f to your computer and use it in GitHub Desktop.
Save tsyber1an/f8667079bd863623aa9f to your computer and use it in GitHub Desktop.
def beg(target_function):
@wraps(target_function)
def wrapper(*args, **kwargs):
msg, say_please = target_function(*args, **kwargs)
if say_please:
return "{} {}".format(msg, "Please! I am poor :(")
return msg
return wrapper
@beg
def say(say_please=False):
msg = "Can you buy me a beer?"
return msg, say_please
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment