如题··,我在官方文档内(2.X)版本那·· 查找不到···请问是没有?还是我找不到而已。 如果官方文档没有··大家是看什么入门decorator的?
|
xiandao7997Jan 2, 2015 via Android
1
不懂 decorator, 不过 lz 的问题可以搜索 decorator site:python.org :)
另,找到一个教程, http://www.cnblogs.com/vamei/archive/2012/09/13/2682778.html |
|
binuxJan 2, 2015
2
https://docs.python.org/2/reference/compound_stmts.html#function-definitions
你还要多详细,本来就没多少东西,就一语法糖 |
|
yourmoonlightJan 3, 2015
3
|
|
zonyitooJan 3, 2015
4
decorator就是一个语法糖来的而已呀
|
|
yourmoonlightJan 3, 2015
5
python decorators are equated to macros.
the goal of macros is to provide a way to modify elements of the language. that's what decorators do in python, they modify functions, in the case of class decorators, entire classes. |
|
6
的确只是语法糖而已,nothing more
|
|
7
原来如此··小白就此谢过大家的回复啦··
|
|
clvrobjJan 3, 2015
8
虽然lz已经原来如此了,还是留下个觉得有用的链接 https://www.python.org/dev/peps/pep-0318/
|