SAVE / RESTORE in Python

Save/Restore is probably the single best feature of IDL that, sadly, is very poorly replicated in Python. For 1 or 2 dimensional variables, you can use Pylab's save/load, but I never use such piddling tiny arrays. For higher dimensional objects, either using FITS files (a pain because of header definitions) or pickling ought to work. e.g.: import numpyimport picklex=ones([10,10,10,10],dtype='float64')pickle.dump(x,open('x.pysav','w'))X = pickle.load(open('x.pysav','r'))

Comments