Last active
February 21, 2017 02:29
-
-
Save GameXG/ed84b114067fb4a7b398cb811a9241ca 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 w(a = 234): | |
if callable(a): | |
# 目的是当用户 @w 时也有效。 | |
return w()(a) | |
def ww(func): | |
@wraps(func) | |
def fffff( *args, **kwargs): | |
print (a) | |
return func(*args, **kwargs) | |
return fffff | |
return ww | |
@w(123) | |
def hello3(): | |
"""test hello 3""" | |
print ('hello world3') | |
# 实际这里 hello3 已经变成了 fffff 函数。 | |
# 所以会先输出 123 再输出 hello world3。 | |
hello3() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment