官术网_书友最值得收藏!

How to do it...

  1. To create bytecode, simply execute a Python program via python <program>.py.
  2. When running a Python command from the command line, there are a couple of switches that can reduce the size of the compiled bytecode. Be aware that some programs may expect the statements that are removed from the following examples to function correctly, so only use them if you know what to expect.

-O removes assert statements from the compiled code. These statements provide some debugging help when testing the program, but generally aren't required for production code.

-OO removes both assert and __doc__ strings for even more size reduction.

  1. Loading programs from bytecode into memory is faster than with source code, but actual program execution is no faster (due to the nature of the Python interpreter).
  2. The compileall module can generate bytecode for all modules within a directory. More information on the command can be found at https://docs.python.org/3.6/library/compileall.html.
主站蜘蛛池模板: 许昌市| 南城县| 柘荣县| 青铜峡市| 陵川县| 高台县| 金阳县| 文登市| 姜堰市| 富平县| 松滋市| 西盟| 尼木县| 东莞市| 莱西市| 利辛县| 霸州市| 德安县| 三河市| 湖北省| 大同市| 东兴市| 建宁县| 长阳| 兴文县| 青阳县| 盐津县| 驻马店市| 漾濞| 桐庐县| 乐陵市| 东兰县| 沁水县| 红安县| 工布江达县| 遂溪县| 通道| 登封市| 南郑县| 闸北区| 齐河县|