### 装饰器是什么

“A decorator is a callable that takes a callable as input and returns another callable.” – Dan, Python Tricks: The Book

NOTE

### 什么是闭包

“Actually, a closure is function with an extended scope that encompasses non-global variables referenced in the body of the function but not defined there.” ——Fluent Python

### 怎么用装饰器

#### 注意事项

decorator stacking虽好，也没有层次限制，但是当堆叠太多的时候还是对程序的运行效率带来压力，毕竟本身是函数的调用。

NOTE
Python也是有Class Decorator的哦，后面可能会讲到:-)

A common use of class decorators is to be a simpler alternative to some use-cases of metaclasses. In both cases, you are changing the definition of a class dynamically. (Primer on Python Decorators)