Silke von Bargen wrote:

That still leaves the question of what to do with __file__ (for which
even the solution in the PEP isn't particularly clean). Perhaps the
thing to do there is to have __file__ always point to the source file
and introduce a __file_cached__ that points to the bytecompiled file on
disk (set to None if it doesn't exist, as may be the case for __main__
or due to writing of bytecode files being disabled).
And what if there isn't a source file, because I want to deploy the byte-code only? This is possible now, but would be impossible if there was this kind of distinction.

You could argue that you put the .pyc file in the __pyr__ directory if
the .py file exists (the .pyc file is there for performance reasons). If
there's no .py file then the .pyc file could be put in the main
directory.

That means that you can 'clean' your directory hierarchy by deleting the
__pyr__ directories (they'll be regenerated on demand) and leave any
other .pyc files (no source .py file) intact.

That said, and understanding Martin von Löwis objections against ZIP files,
I'm +1 for something like module.some-kind-of-version.pyc instead of subdirectories.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to