Skip to content

Commit 80cda03

Browse files
authored
闭包与装饰器
闭包与装饰器
1 parent a73d7aa commit 80cda03

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

exercise/11/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 练习一 定义装饰器,用于打印函数执行的时间
2+
1. 统计函数开始执行和结束执行的时间
3+
2. 扩展练习:为装饰器传入超时时间,函数执行超过指定时间后退出
4+
5+
6+
7+
8+
# 练习二 定义装饰器,实现不同颜色显示执行结果的功能
9+
1. 向装饰器传递参数,通过传递的参数获取到输出的颜色
10+
2. 被装饰函数的print( )输出根据装饰器得到的颜色进行输出

0 commit comments

Comments
 (0)