Created
December 26, 2013 21:43
-
-
Save ankitr/8139083 to your computer and use it in GitHub Desktop.
This is why I love Python.
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
def api_method(function, start=None): | |
"""Returns a dictionary of methods from a list of methods returned.""" | |
method_list = function() #should be an iterable object of functions | |
method_dict = dict() | |
for method in method_list: | |
if start: | |
def combiner(*args): | |
start() | |
method(*args) | |
method_dict[method.__name__] = combiner | |
else: | |
method_dict[method.__name__] = method | |
return method_dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment