Created
February 16, 2015 14:43
-
-
Save salexkidd/893cf6575e6282a6d0ef to your computer and use it in GitHub Desktop.
Python decorator leraning 2
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 remove_five(dl): | |
dl.remove(5) | |
return dl | |
def test_decorator(func): | |
print("now test_decorator") | |
def _wrapper(dl): | |
dl = remove_five(dl) | |
return func(dl) | |
return _wrapper | |
@test_decorator | |
def test_func_1(data_list): | |
return data_list | |
def test_func_2(data_list): | |
return data_list | |
if __name__ == "__main__": | |
print( | |
remove_five( | |
test_func_2(range(1, 11)) | |
) | |
) | |
print(test_func_1(range(1, 11))) | |
"./base.py" 28L, 480C written |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment