[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [SPAM: 3.500] Re: [pygame] This one baffles me



Both good points. I stand corrected. Its not like anyone /has/ to listen to me... just that we reached 8 different solutions by my count, with them starting to use more obscure syntax and functions... Just wanted to point out that it was starting to get a bit ridiculous, thats all. :)

-Tyler

On Mon, May 18, 2009 at 2:52 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
On Tue, May 19, 2009 at 12:29 AM, Tyler Laing <trinioler@xxxxxxxxx> wrote:
Ahem: http://blue.bikeshed.com/


There's no need for everyone to jump in and start offering solutions to a simple problem. There's lots of different ways to solve it. People have different opinions on what is the best way. But irregardless, I'm pretty sure the GP knows how to do it now.

-Tyler


... except if the offered solutions are wrong, or there is a better way that people might be interested in, or people just want to have a discussion in a place where they can talk about whatever they want to.

The replace(..., "\t") solutions insert tabs, not replace tabs with spaces.  So they're not good.
 
Should write the result to a temporary file, then do a move from the temporary file into the new file.  This way if there is a bug in your code half way through writing it won't wipe out the original...  Also move is an atomic operation, whereas writing to the file you just read from can cause all sorts of problems.  Say something tries to read your file halfway through your write, then they will get half a file back... whereas if you write to a temporary file then move it, every other program reading your file will never get a corrupt file.


cu,



--
Visit my blog at http://oddco.ca/zeroth/zblog