zhihu-python icon indicating copy to clipboard operation
zhihu-python copied to clipboard

使用 @decorators 装饰器 来简化函数

Open Allianzcortex opened this issue 8 years ago • 0 comments

use @decorators to simplify the structure of code

以 @decorators 装饰器为例,来简化操作。避免在每次调用函数前用 if 语句来判断是否执行 parse() 函数。

仅仅是一个 demo:-) 以 get_post_count() 作为例子。如果 @egrcc 觉得这种方式可以推广的话欢迎采纳~

Allianzcortex avatar Jun 02 '16 07:06 Allianzcortex