标签:turn **kwargs function mat inner int form war 内容
#一、装饰器的作用就是给已经实现的功能再扩展新的功能
#二、无参数的
# def wohaoshuai1(func):
# print("wohaoshuai1")
# return func
#
# @wohaoshuai1
# def wohaoshuai2():
# print("wohaoshuai2")
#
# # 与上面装饰内容原理相同
# # wohaoshuai2 = wohaoshuai1(wohaoshuai2)
# wohaoshuai2()
#三、有参数
# def wohaoshuai1(function):
# def inner(*args,**kwargs):
# print("wohaoshuai1")
# return function(*args,**kwargs)
# print(inner)
# return inner
#
# @wohaoshuai1
# def wohaoshuai2(name,wohaoshuai,c):
# print("wohaoshuai2 {0} {1} {2}".format(name,wohaoshuai,c))
# return 1
#
# print(wohaoshuai2)
# a = wohaoshuai2("aaa","bbb",c=1)
# print(a)
#
# <function wohaoshuai1.<locals>.inner at 0x05536108>
# <function wohaoshuai1.<locals>.inner at 0x05536108>
# wohaoshuai1
# wohaoshuai2 aaa bbb 1
# 1
标签:turn **kwargs function mat inner int form war 内容
原文地址:https://www.cnblogs.com/Presley-lpc/p/9218190.html