Does Python cache repeatedly accessed files?

允我心安 提交于 2021-02-10 05:37:35

问题


I was wondering if Python is smart enough enough to cache repeatedly accessed files, e.g. when reading the same CSV with pandas or unpickling the same file multiple times.

Is this even Python's responsibility, or should the operating system take care of it?


回答1:


No, Python is just a language and doesn't really do anything on its own. A particular Python library might implement caching, but the standard functions you use to open and read files don't do so. The higher-level file-loading functions in Pandas and the CSV module don't do any caching either.

The operating system might do some caching of its own, but you can't control that from within Python.



来源:https://stackoverflow.com/questions/38144825/does-python-cache-repeatedly-accessed-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!