[Python-Dev] __file__
Glenn Linderman
v+python at g.nevcal.com
Sat Feb 27 00:35:16 CET 2010
On approximately 2/26/2010 2:55 PM, came the following characters from
the keyboard of Brett Cannon:
>
> Maybe Greg's and my response to the mention of dropping this feature
> is too strong -- after all we're both dinosaurs. And maybe the
> developers who want the feature can write their own loader.
>
>
> We could also provide if necessary.
So if the implementation stores .pyc by default in a version-specific
place, then it seems there are only two things needed to make a python
byte-code only distribution...
1) rename all the .pyc to .py
2) packaging
When a .pyc is renamed to .py, Python (3.1 at least) recognizes and uses
it... I assume by design, rather than accident, but I don't know the
history.
I didn't experiment to discover what __file__ and __cached__ get set to
in this case (especially since I don't have a version with the latter :) ).
I speculate that packaging a distribution in this manner would be
slightly different that how it is currently done, but I also suspect
that it would avoid the same half of the stat calls, to aid performance.
--
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking
More information about the Python-Dev
mailing list