On Sat, Jan 4, 2020 at 1:16 AM Stephen J. Turnbull <[email protected]> wrote: > If you really want to save disk space measured in MB, I guess you'd > probably want LRU semantics, and possibly a blacklist of modules that > are only used interactively and at most once a day or so, so the time > to import doesn't really matter. It would be easy enough to write a > script to do the cleaning (the stat module can get you the access > times), and Python will take care of the recompilation since it only > ever executes compiled code. >
Be aware that access times aren't always accurate, since they depend on the system performing a write every time you request a read. That's an inefficiency that can easily be disabled (perhaps selectively - the "relatime" mount option in Linux means to update the access time only if the file's been changed since it was last accessed), at the price of breaking the stats of something like you propose. But honestly, if you're worried about a MB here and a MB there, you probably will do better to zip up the stdlib than to fiddle around with deleting stale modules. ChrisA _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/EK7MG22LF2ONRNUTDXNCD3XQEDMEMRBP/ Code of Conduct: http://python.org/psf/codeofconduct/
