[Python-Dev] __file__
Guido van Rossum
guido at python.org
Sat Feb 27 02:11:11 CET 2010
On Fri, Feb 26, 2010 at 4:58 PM, Ian Bicking <ianb at colorstudy.com> wrote:
> The one issue I thought would be resolved by not easily allowing
> .pyc-only distributions is the case when you rename a file (say
> module.py to newmodule.py) and there is a module.pyc laying around,
> and you don't get the ImportError you would expect from "import
> module" -- and to make it worse everything basically works, except
> there's two versions of the module that slowly become different. This
> regularly causes problems for me, and those problems would get more
> common and obscure if the pyc files were stashed away in a more
> invisible location.
>
> I can't even tell what the current proposal is; maybe this is
> resolved? If distributing bytecode required renaming pyc files to .py
> as Glenn suggested that would resolve the problem quite nicely from my
> perspective. (Frankly I find the whole use case for distributing
> bytecodes a bit specious, but whatever.)
Barry's PEP would fix this even if we kept supporting .pyc-only files:
the lingering .pyc files will be in the __pycache__ directory which is
*not* searched -- only .pyc files directly in the source directory
will be found -- where the PEP will never place them, at least not by
default.
--
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev
mailing list