-
__debug__
-
This constant is true if Python was not started with an -O option.See also theassert statement.
Note
The names None and __debug__ cannot be reassigned(assignments to them, even as an attribute name, raiseSyntaxError),so they can be considered “true” constants.
Changed in version 2.7:Assignments to __debug__ as an attribute became illegal.
__debug__默认都是True的,除非设置了-O选项
-
-O
-
Turn on basic optimizations. This changes the filename extension forcompiled (bytecode) files from .pyc to .pyo. See alsoPYTHONOPTIMIZE.
sys.path_hooks
用来hook import是的路径
一般代码打包后,例如放到一个.script后缀文件里面,可以自定义一个类,hook住,这样可以对代码加密等一类的处理