Compiling a Python File on Mac OS X Tiger

Discussion in 'Python' started by Asad Habib, Jul 26, 2005.

  1. Asad Habib

    Asad Habib Guest

    Hello. I am working on Tiger and wanted to find out how to compile a
    Python (.py) file into a .pyc file and then into a .pyo file. Can the
    compilation be achieved within the interpreter? Also, I am
    new to Python and wanted to know the difference between .pyc and .pyo
    files. Is this comparison similar to C? Any help would be appreciated.

    - Asad
    Asad Habib, Jul 26, 2005
    1. Advertisements

  2. Asad Habib

    Jacob Page Guest has some good
    explanations. To generate the .pyo files from the interpreter, add the
    -O option.

    The difference between .pyc and .pyo files is that .pyo files are
    optimized a bit; for example docstrings are removed (which will break
    pydoc tests). According to the above link, .pyo files don't run any
    faster; they just load faster.
    Jacob Page, Jul 26, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.