Created
March 27, 2009 00:59
-
-
Save neilmock/86478 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
def teh_decorator(func): | |
def wrapped(*args, **kwargs): | |
if len(args) > 0: | |
func.new_thing = args[0] | |
return func(**kwargs) | |
return wrapped | |
@teh_decorator | |
def testmeyo(): | |
pass | |
# so how do i get "new_thing" attribute to print? | |
if __name__=='__main__': | |
testmeyo("should_be_value_of_new_thing") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment