![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
装饰器
Test_C.
这个作者很懒,什么都没留下…
展开
-
Python装饰器
Python 装饰器 简言之,python装饰器就是用于拓展原来函数功能的一种函数,这个函数的特殊之处在于它的返回值也是一个函数,使用python装饰器的好处就是在不用更改原函数的代码前提下给函数增加新的功能。 import time,random # 装饰器传递参数 def test(t=123): print(t) # 要装饰的函数 def outer(func):...原创 2018-11-14 23:08:37 · 126 阅读 · 0 评论 -
一个装饰器的面试题
加括号: def tag(name=None,title=None,*args,**kwargs): def test(func): def test2(text,*args,**kwargs): content = func(text,*args,**kwargs) if name == None: ...原创 2019-06-25 18:00:18 · 469 阅读 · 0 评论