Need a little parse help

Peter Hansen peter at engcorp.com
Tue May 10 23:14:06 EDT 2005


Delaney, Timothy C (Timothy) wrote:
> Peter Hansen wrote:
>>In my opinion, if the code fits on one screen and just reads stuff
>>from one file and, maybe, writes to another, you can safely and with
>                             ^^^^^^
>>clean conscience ignore Mike's advice (but remember it for later!).
> 
> Remember, finalisers are not called when Python exits. So if you don't
> explicitly close the file you are *writing* to, it may not be flushed
> before being closed (by the OS because the process no longer exists).

Ouch... I'd forgotten/never heard that I guess.  If that's true and all 
there is to the matter, I would think we'd all have encountered numerous 
times when our output files were not properly written.  Yet I've never 
encountered this situation myself, nor heard of anyone else ever having 
trouble as a result of it.  What gives?

-Peter



More information about the Python-list mailing list