-
-
Save paltman/86496 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
class kewlness(object): | |
def __init__(self, func): | |
self.func = func | |
def __call__(self, *args, **kwargs): | |
if len(args) > 0: | |
self.new_thing = args[0] | |
return self.func(*args, **kwargs) | |
def __repr__(self): | |
return self.func.__doc__ | |
@kewlness | |
def testmeyo(*args): | |
pass | |
# so how do i get "new_thing" attribute to print? | |
if __name__=='__main__': | |
testmeyo("should_be_value_of_new_thing") | |
print testmeyo.new_thing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment