[Python-Dev] __file__ and bytecode-only

Nick Coghlan ncoghlan at gmail.com
Sat Mar 13 15:17:09 CET 2010

Barry Warsaw wrote:
> *creation* is the key here.  As per BDFL pronouncement, we'll support reading
> pyc-only modules just like we do today.  This is in PEP 3147.  We won't
> support creating them though.

The creation side could be made a little more explicit in the PEP. We
could also do something via the compileall module.

(Pause while Nick goes and reads the source code for compileall for the
first time ever...)

Hmm - methinks the PEP actually needs to talk explicitly about the
py_compile and compileall modules. These compile the files directly
rather than using the import system's side-effect, so they'll need to
understand the intricacies of the new system.

While it's probably OK if the import side-effects only create files
using the new scheme, the standard library modules will likely need to
support both schemes (although I'm not sure if "same as import system"
or "same as Python 3.1" make more sense as the default semantics -
probably the former).


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list