Created
August 19, 2010 13:38
-
-
Save mkuhn/537895 to your computer and use it in GitHub Desktop.
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
# with the help of decorators, keep track of the functions | |
# we would like to use for fitting | |
fit_functions = [] | |
def fit_func(f): | |
fit_functions.append(f) | |
return f | |
class C(object): | |
def __init__(self): | |
... | |
@fit_func | |
def fit1(self): | |
"""This is the first function""" | |
... | |
@fit_func | |
def fit2(self): | |
"""This is the second function""" | |
... | |
## This function is disabled by putting the decorator in a comment | |
# @fit_func | |
def fit3(self): | |
"""This is the third function""" | |
... | |
def main(): | |
c = C() | |
for f in fit_functions: | |
fit = f(c) | |
print fit, f.__doc__ | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment