Skip to content

Instantly share code, notes, and snippets.

@pratikmallya
Last active December 24, 2015 08:29
Show Gist options
  • Save pratikmallya/6771130 to your computer and use it in GitHub Desktop.
Save pratikmallya/6771130 to your computer and use it in GitHub Desktop.
This piece of code is what I'm using to clarify certain function-related concepts in Python, especially those relating to decorators
# Test decorator functionality in Python
def log(F):
def print_args(*args, **kwargs):
print args, kwargs
return print_args
@log
def holy_smokes(a, b, c):
print a + b + c
if __name__ == "__main__":
holy_smokes(1,2,3)
@pratikmallya
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment