[Python-Dev] #12982: Should -O be required to read .pyo files? (original) (raw)
Steven D'Aprano steve at pearwood.info
Thu Jun 14 05:25:25 CEST 2012
- Previous message: [Python-Dev] #12982: Should -O be required to *read* .pyo files?
- Next message: [Python-Dev] #12982: Should -O be required to *read* .pyo files?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Jun 13, 2012 at 09:54:30PM -0400, Terry Reedy wrote:
>So, no, we
You mean the interpreter?
Yes.
>should never use
Do you mean import or execute? Current, the interpreter executes any bytecode that gets imported.
Both.
>.pyo files unless explicitly told to do so,
What constitutes 'explicitly told to do so'? Currently, an 'optimized' file written as .pyo gets imported (and hence executed) if 1) the interpreter is started with -O 2) a custom importer ignores the absence of -O 3) someone renames x.pyo to x.pyc.
Any of the above are fine by me.
I oppose this one:
- the interpreter is started without -O but there is no .pyc file.
since it can lead to a mismatch between what I (the developer) thinks is being run and what is actually being run (or imported).
For the avoidance of doubt, if my end-users secretly rename .pyo to .pyc files, that's my problem, not the Python's interpreter's problem. I don't expect Python to be idiot-proof.
-- Steven
- Previous message: [Python-Dev] #12982: Should -O be required to *read* .pyo files?
- Next message: [Python-Dev] #12982: Should -O be required to *read* .pyo files?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]