when should I explicitly close a file?

Adam Tauno Williams awilliam at whitemice.org
Thu Apr 22 05:59:33 EDT 2010


On Thu, 2010-04-22 at 12:53 +1200, Lawrence D'Oliveiro wrote:
> In message <4bc9aadb$1 at dnews.tpgi.com.au>, Lie Ryan wrote:
> > Since in python nothing is guaranteed about implicit file close ...
> It is guaranteed that objects with a reference count of zero will be 
> disposed. In my experiments, this happens immediately.

A current implementation specific detail.  Always close files.
Otherwise, in the future, or on a different run-time, your code will
break.





More information about the Python-list mailing list