Python path and append

Steven D'Aprano steve at pearwood.info
Fri Apr 29 21:44:52 EDT 2016


On Sat, 30 Apr 2016 06:26 am, boB Stepp wrote:

> On Mon, Apr 25, 2016 at 8:51 PM, Steven D'Aprano <steve at pearwood.info>
> wrote:
> 
>> See here for the *start* of a more professional approach:
>>
>>
http://code.activestate.com/recipes/579097-safely-and-atomically-write-to-a-file/
> 
> What else would I need to know/consider in order to have a *complete*
> professional approach?

When I know, I'll tell you.

I think the answer depends in part on what you're trying to do. The
requirements for, say, an ACID-compliant database are much heavier than for
most applications. As far as regular applications go, I'd like to see:

- the above tested and debugged for Windows and MacOS;

- should it save the previous version of the file?

- if so, how many backup files should it keep?

- should it try to sync and flush the disk on saving the file?

- anything I haven't thought of?


Some of those (like the keeping of backups) is probably something that
should be given as an option to the end-user.


-- 
Steven




More information about the Python-list mailing list