Is there a way to cache python file handles? I have a function that takes a netCDF file path as input, opens it, extracts some data from the netCDF file and closes it. It gets called a lot of times, and the overhead of opening the file each time is high.
How can I make it faster by maybe caching the file handle? Maybe there is a python library to do this
0 Replies