when should I explicitly close a file?

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Thu Apr 22 00:03:33 EDT 2010


On Thu, 22 Apr 2010 12:53:51 +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. 

Not all Python implementations have reference counts at all, e.g. Jython 
and IronPython. Neither of those close files immediately.


> In my experiments, this happens immediately.

Are your experiments done under PyPy, CLPython, or Pynie?



-- 
Steven



More information about the Python-list mailing list