Re: reload from ( was Python FAQ ... )

Bennett Todd (bet@std.sbi.com)
Thu, 18 Nov 1993 11:40:02 -0500 (EST)

tnb2d@henson.cs.virginia.edu writes:
> In our Alice system (a set of python classes) whenever a 3D
>object file is loaded from disk it is cached, so if a copy of that
>object is requested it loads a lot faster, right? But what if you've
>made changes to the file on disk and want to load it in with those
>changes?

Howabout using the usual trivial solution: when import sucks a file from
disk, have it stash away a copy of the dev maj/min, inum, and ctime. Then on
a subsequent request to import the same module, it could start by ignoring
the cache, repeat the search algorithm until it gets to the file, then check
the stat info for that file to see if it can trust the cache. This would
take care of the general case: not only if you modify the file, but if you
remove it and replace it with a symlink pointing elsewhere, or even remove
it from a directory eariler on your search path, exposing something later on
your search path.

-Bennett
bet@sbi.com