deepforge
deepforge copied to clipboard
Custom serialization/deserialization for file handles
It would be nice to have support for serialization/deserialization for file handles (_io.TextWrapper) out of the box. The serializer and deserializer should be rather trivial:
import os
def save_textwrapper(handle, outfile):
os.system('ln -s ' + handle.name + ' ' + outfile.name)
def load_textwrapper(infile):
return infile
This would result in the creation of a symbolic link on save (avoiding data copy) and just passing the file handle through when loading the file.
Why is a file handle called _io.TextWrapper ? Is just an example?