Python Forum

Full Version: i want to create my own file-like object
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i want to create my own file-like object that behaves by renaming a file to be written to append a unique temporary string to the created name and on close to close the open file and rename the temporary file name to the given one. this could also do meaningful checks to be sure that permission is such that the rename is allowed, or raising an exception at open time instead of getting it at close time.

your suggestions?