Skip to content

Instantly share code, notes, and snippets.

@jianghu52
Created June 9, 2014 11:34
Show Gist options
  • Save jianghu52/04f6144f897e9326f3a1 to your computer and use it in GitHub Desktop.
Save jianghu52/04f6144f897e9326f3a1 to your computer and use it in GitHub Desktop.
def decorator_whith_params_and_func_args(arg_of_decorator):
def handle_func(func):
print "start handle"
def warp():
print "start warp"
func()
print "end warp"
print "end handle"
return warp
return handle_func
@decorator_whith_params_and_func_args("123")
def foo4():
print "Content"
foo4()
#输出结果为
#start handle
#end handle
#start warp
#Content
#end warp
#而不是我希望的
#start handle
#start warp
#Content
#end warp
#end handle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment