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

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.
主站蜘蛛池模板: 郓城县| 开远市| 资源县| 泾阳县| 莱州市| 沽源县| 彩票| 华蓥市| 邓州市| 松阳县| 东光县| 慈利县| 元朗区| 栾川县| 富裕县| 巴塘县| 阿尔山市| 西和县| 松阳县| 曲阳县| 许昌县| 灵台县| 通榆县| 福鼎市| 伊吾县| 汾西县| 安吉县| 南乐县| 炎陵县| 施甸县| 班玛县| 屏东县| 绿春县| 灵璧县| 陕西省| 贡觉县| 洞口县| 扎鲁特旗| 平阳县| 镶黄旗| 六盘水市|