Cacheing sys.path rather than building it each time?

Robert W. Cunningham rcunning at acm.org
Sun Apr 9 00:47:40 EDT 2000


Gordon McMillan wrote:

> Hamish Lawson wrote:
>
> > Steve Holden wrote:
> >
> > > Probably not an awfully good idea, given that "installation" of
> > > a new module often consists of just dropping a ".py" file into
> > > a library directory.  Without an common "install" process the
> > > work of checking whether the cahced path is up to date would
> > > be almost as much as that of building the path from scratch
> > > as is now done.
> >
> > Had you thought I was proposing that such a check be done
> > whenever Python was started? I'd agree that the work of checking
> > whether the cached path is up to date would be almost as much
> > work as building the path. However that wasn't part of my
> > proposal.
> >
> > Instead when a module is installed, the pathbuilder tool would be
> > run either by the module's install program (perhaps via the
> > distutils) or manually by the user. (You could even run it at
> > scheduled intervals if you thought that necessary to catch
> > omissions.) My goal is to avoid having the path built every time
> > Python starts.
> >
> > A command-line option for the Python interpreter could be used to
> > determine whether it uses the cached path or builds the path from
> > scratch; the decision as to which should be the default I'll
> > leave to others.
>
> There are 3 pieces to the puzzle.
>
> 1) How do you find those things that Python requires
> (bootstrap).
> 2) How do you build the list of places to look for Python
> modules.
> 3) What is the complete universe of importable Python
> modules.

This  discussion seems to have swerved away from the concept of the
feature, and toward the automation of the use of that feature.

For my $0.02, build in the feature, and let it be Caveat Emptor for all
users until a suitable automation and management system is imposed upon
it.  For a fairly static system, it will bring significant speed
benefit, and if things start acting strange, it will soon become
automatic to first invalidate the cache before doing any deeper
debugging.

Those who don't understand the feature, or don't trust it, or are just
afraid to use it, will not be forced to use it.

-BobC





More information about the Python-list mailing list