when should I explicitly close a file?

Benjamin Kaplan benjamin.kaplan at case.edu
Fri Apr 23 01:04:33 EDT 2010


On Fri, Apr 23, 2010 at 12:29 AM, Lawrence D'Oliveiro
<ldo at geek-central.gen.new_zealand> 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? Nothing in the Python spec calls for reference-counting. And (AFAIK)
everything that runs on the JVM or CLR uses garabage collection and not
reference counting. Have you heard of those things before? They're rather
popular.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100423/725600de/attachment.html>


More information about the Python-list mailing list