[Python-Dev] Inconsistent behaviour in import/zipimport hooks

James Y Knight foom at fuhm.net
Thu Nov 10 00:15:02 CET 2005

On Nov 9, 2005, at 6:05 PM, Brett Cannon wrote:

> I would have  no issue with removing .pyo files and have .pyc files
> just be as optimized as they  the current settings are and leave it at
> that.  Could have some metadata listing what optimizations occurred,
> but do we really need to have a specific way to denote if bytecode has
> been optimized?  Binary files compiled from C don't note what -O
> optimization they were compiled with.  If someone distributes
> optimized .pyc files chances are they are going to have a specific
> compile step with py_compile and they will know what optimizations
> they are using.

This sounds quite sensible. The only thing I'd add is that iff there  
is a .py file of the same name, and the current optimization settings  
are different from those in the .pyc file, python should recompile  
the .py file.


More information about the Python-Dev mailing list