On Wed, Feb 3, 2010 at 05:07, Antoine Pitrou <solip...@pitrou.net> wrote: > Barry Warsaw <barry <at> python.org> writes: >> >> Python 3 uses the .py file for __file__ but I'd like to see a transition to >> __source__ for that, with __cache__ for the location of the PVM, JVM, LLVM or >> whatever compilation cache artifact file. > > Well, I don't think we need another transition... Just keep __file__ for the > source file, and add a __cache__ or __compiled__ attribute for the compiled > file(s).
So what happens when only bytecode is present? As of right now __file__ is set to the path of the bytecode if no source exists (needed for reloading along with backwards-compatibility). Would you set __file__ = __compiled__? Or would __file__ be set to None? I am going to assume the former for backwards-compatibility, but I figured I would bring up the issue as it means getting only the source path would become ``__file__ if __file__ != __compiled__ else None``. > > Since there might be several compiled files for a single source file (for > example, a .pyc along with a JITted native .so), __cache__ should probably be > a > tuple rather than a string. Maybe, but only one of them will be used. Having to check for all of the possible compiled versions of a module is just a waste of time; you should only care about what import used to load the module. -Brett _______________________________________________ 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