В Воскресенье, 15 апр. 2018 в 1:12 , Serhiy Storchaka <storch...@gmail.com> написал:
Actually the reliable code should write into a separate file and replace
the original file by the new file only if writing is successful. Or
backup the old file and restore it if writing is failed. Or do both. And handle hard and soft links if necessary. And use file locks if needed to prevent race condition when read/write by different processes. Depending
on the specific of the application you may need different code. Your
three lines are enough for a one-time script if the risk of a powerful
blackout or disk space exhaustion is insignificant or if the data is not
critical.

I not sure that solving described problems is a task of this level, maybe it problem for higher level

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to