Python Forum
i want to create my own file-like object - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: i want to create my own file-like object (/thread-25993.html)



i want to create my own file-like object - Skaperen - Apr-17-2020

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?