[Python] RE: How to safely maintain a status file

Prasad, Ramit ramit.prasad at jpmorgan.com
Fri Jul 13 13:59:59 EDT 2012


> >> Well "neat tricks" aside, I am of the firm belief that deleting files
> should
> >> never be possible whilst they are open.
> > This is one of the few instances I think Windows does something better
> > than OS X. Windows will check before you attempt to delete (i.e. move
> > to Recycling Bin) while OS X will move a file to Trash quite happily
> > only tell me it cannot remove the file when I try to empty the Trash.
> While I was trained in the Unix way, and believe it is entirely
> appropriate to delete an open file.  Even if I my program is the opener.
>   It's just too handy to have temp files that disappear on their own.
> 
> As opposed to periodically going to %TEMP% and deleting them manually.  Gah.

In my experience things that are "too handy" are usually breaking
what I consider "right". That being said, I am not entirely sure
what I think is "right" in this circumstance. I suppose it depends
on if I am the person deleting or the person who is looking at
a file that is being deleted. Or the user who just wants the stupid
computer to just Work.

I lean slightly towards the POSIX handling with the addition that 
any additional write should throw an error. You are now saving to 
a file that will not exist the moment you close it and that is probably 
not expected.





Ramit
This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  



More information about the Python-list mailing list