Skip to content

Instantly share code, notes, and snippets.

@erikkaplun
Created January 30, 2012 14:31
Show Gist options
  • Save erikkaplun/1704701 to your computer and use it in GitHub Desktop.
Save erikkaplun/1704701 to your computer and use it in GitHub Desktop.
@selfdocumenting decorator
import inspect
def selfdocumenting(f):
f.__doc__ = inspect.getsource(f)
return f
# well written method
@selfdocumenting
def add_numbers(number1, number2):
return number1 + number2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment