[Python-ideas] BackupFile (original) (raw)

Christian Heimes lists at cheimes.de
Mon Jun 25 15:59:40 CEST 2012


Am 25.06.2012 14:17, schrieb Kim Gräsman:

Hello,

I'm new here, so forgive me if this has been discussed before or is off-topic. I came up with a mechanism that I thought might be useful in the Python standard library -- a scope-bound self-restoring backup file. I came to this naïve implementation;

Are you aiming for atomic file rollover backed by a temporary file? That's the common way to safely overwrite an existing file. It works differently than your code.

I've some code laying around somewhere that implements a RolloverFile similar to tempfile.NamedTemporaryFile.

Christian



More information about the Python-ideas mailing list