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

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.
主站蜘蛛池模板: 太原市| 迭部县| 宁阳县| 沽源县| 兴山县| 大姚县| 龙游县| 邛崃市| 九台市| 郸城县| 察雅县| 百色市| 达孜县| 特克斯县| 扬州市| 闽侯县| 武穴市| 长沙县| 松阳县| 拜泉县| 辽阳市| 长沙县| 潜江市| 阜南县| 新郑市| 卢氏县| 大兴区| 深州市| 安新县| 察雅县| 泸州市| 肇东市| 顺义区| 米易县| 清流县| 呼伦贝尔市| 咸丰县| 萝北县| 靖州| 岗巴县| 蒙山县|