A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2006-November/069915.html below:

[Python-Dev] Importing .pyc in -O mode and vice versa

[Python-Dev] Importing .pyc in -O mode and vice versaGreg Ewing greg.ewing at canterbury.ac.nz
Thu Nov 9 00:29:43 CET 2006
Martin v. Löwis wrote:

> a) the directory cache is out of date, and you should
>    re-read the directory
> b) the module still isn't there, but is available in
>    a later directory on sys.path (which hasn't yet
>    been visited)
> c) the module isn't there at all, and the import will
>    eventually fail.
> 
> How can the interpreter determine which of these it
> is?

It doesn't need to - if there is no file for the module
in the cache, it assumes that the cache could be out
of date and rebuilds it. If that turns up a file, then
fine, else the module doesn't exist.

BTW, I'm not thinking of cacheing individual directories,
but scanning all the directories and building a single
qualified_module_name -> pathname mapping. If the cache
gets invalidated, all the directories along the path
are re-scanned, so a new module will be picked up
wherever it is on the path.

--
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