[Python-ideas] Importing orphaned bytecode files

Nick Coghlan ncoghlan at gmail.com
Thu Dec 10 11:38:06 CET 2009

Guido van Rossum wrote:
> On Wed, Dec 9, 2009 at 10:56 AM, Brett Cannon <brett at python.org> wrote:
>> On Wed, Dec 9, 2009 at 02:22, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>> Ben Finney wrote:
>>>> Right, that's what I thought. I was only looking for a way to say “only
>>>> use a bytecode file if the corresponding source code file exists”, and
>>>> then trying to define “corresponding source code file”.
>>> As Guido said, the check goes the other way: the interpreter looks for
>>> source files first, and if it doesn't find one, only then does it look
>>> for orphaned bytecode files (pyo/pyc).
>> Just a data point: I reversed that order in importlib to match mental
>> semantics.
> IIRC zipimport also reverses the order.

Hmm, not as orthogonal as I thought then :P

I guess it is a credit to the PEP 302 API that I've never needed to care
that zipimport might have the check the other way around :)


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

More information about the Python-ideas mailing list