Tue, Jul 26, 2005 at 01:41:36PM +1000, Steven D'Aprano пишет: > Long ago, when dinosaurs roamed the Earth, (a.k.a. > "before OS X on the Macintosh") Apple suggested a bit > of Pascal code for safely updating a file: > > http://developer.apple.com/documentation/mac/Files/Files-25.html#MARKER-9-163
That snippet doesn't write data to the existing file. It writes data into the new tempfile and then renames it, as well as the FileInput object does. > Most of the code is Macintosh-specific, but the > principle is not: when over-writing a file, make sure > that the user can recover from any error up to and > including power failure without losing the data on disk. Well, it's what (R)DBMS are for, but plain files are not. -- jk -- http://mail.python.org/mailman/listinfo/python-list