Created
January 30, 2012 14:31
-
-
Save erikkaplun/1704701 to your computer and use it in GitHub Desktop.
@selfdocumenting decorator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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