"finally" for unit test

7stud bbxx789_05ss at yahoo.com
Fri Mar 23 13:55:03 EDT 2007


On Mar 23, 5:18 am, "killkolor" <gabriel.h... at gmail.com> wrote:
> I have .. a single function that ..
> works with files (takes input and outputs in the same file, no return
> values).

That function could cause problems.  If your function reads in the
whole file, modifies the data, and then overwrites the file, what
would happen if something unforeseen happened and your program crashed
after writing one line to the file?  All the data in memory would go
poof! and your file would contain 1 line it--effectively erasing the
entire contents of the file.




More information about the Python-list mailing list