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

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.
主站蜘蛛池模板: 金乡县| 恩施市| 遵化市| 新津县| 尉犁县| 铜川市| 崇仁县| 苏尼特右旗| 抚远县| 阜阳市| 阿巴嘎旗| 永宁县| 聊城市| 芦山县| 东宁县| 梓潼县| 逊克县| 钟山县| 健康| 祁阳县| 同仁县| 红安县| 周至县| 东源县| 临安市| 临沂市| 沁阳市| 镇坪县| 枣强县| 通许县| 云梦县| 获嘉县| 旬邑县| 石屏县| 吴桥县| 临猗县| 离岛区| 临朐县| 昭觉县| 资源县| 崇明县|