Allowing ref counting to close file items bad style?
Dan
bounces at foo.org
Thu Aug 31 19:48:49 EDT 2006
BJörn Lindqvist wrote:
> On 8/30/06, Dan <bounces at foo.org> wrote:
>> Is my data safer if I explicitly close, like this?:
>> fileptr = open("the.file", "w")
>> foo_obj.write(fileptr)
>> fileptr.close()
>
> Have you ever experienced a problem caused by not explicitly closing
> your file handles?
>
No. If I had, I wouldn't have asked the question. It seems to work,
but can I really count on it?
I am a sample of one (In that happy place that Brooks described as
quadrant 1, where a person writes programs for himself to be run on his
own computer. Or perhaps to be run by a handful of co-workers.) Such a
small sample isn't statistically significant; a 100% success rate
doesn't mean much. I've also never had a burned CD go bad, but I know
that they do.
/Dan
--
dedded att verizon dott net
More information about the Python-list
mailing list