A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-March/098040.html below:

[Python-Dev] __file__

[Python-Dev] __file__Greg Ewing greg.ewing at canterbury.ac.nz
Mon Mar 1 00:35:17 CET 2010
Floris Bruynooghe wrote:

> Can't it look for a .py file in the source directory first (1st stat)?
> When it's there check for the .pyc in the cache directory (2nd stat,
> magic number encoded in filename), if it's not check for .pyc in the
> source directory (2nd stat + read for magic number check).

Yes, although that would then incur higher stat overheads for
people distributing .pyc files. There doesn't seem to be a
way of pleasing everyone.

This is all assuming that the extra stat calls are actually
a problem. Does anyone have any evidence that they would
really take significant time compared to loading the module?
Once you've looked for one file in a given directory, looking
for another one in the same directory ought to be quite fast,
since all the relevant directory blocks will be in the
filesystem cache.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4