when should I explicitly close a file?

Adam Tauno Williams awilliam at whitemice.org
Fri Apr 23 06:14:23 EDT 2010


On Fri, 2010-04-23 at 16:29 +1200, Lawrence D'Oliveiro wrote:
> In message <mailman.2119.1271898215.23598.python-list at python.org>, Chris 
> Rebert wrote:
> > On Wed, Apr 21, 2010 at 5:53 PM, 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.
> > Experiment with an implementation other than CPython and prepare to be
> > surprised.
> Any implementation that doesn’t do reference-counting is brain-damaged.

Why?  There are much better ways to do memory management / garbage
collection;  especially when dealing with large applications.




More information about the Python-list mailing list