automatic reclaiminig of limited resources (was Re: [Python-Dev] Product iteration)
Thu, 27 Jul 2000 10:06:17 -0400 (EDT)
>>>>> "PF" == Peter Funk <email@example.com> writes:
PF> Hi all, This rant is about automatically reclaimed resources
PF> like file descriptors.
PF> First let me cite a few sentences from the ancient book
PF> "Programming Python" written by Mark Lutz (p.122). Since this
PF> was the very first available book on Python, it could be
PF> considered as some kind of Python Programmers Guide.
Feel free to think of it as a guide, but don't think of it as a
specification! (It is, as you mention, fairly old.) The only
official word on reclaiming externel resource is the Python Language
Reference -- http://www.python.org/doc/current/ref/.
>Some objects contain references to "external" resources such as open
>files or windows. It is understood that these resources are freed when
>the object is garbage-collected, but since garbage collection is not
>guaranteed to happen, such objects also provide an explicit way to
>release the external resource, usually a close() method. Programs are
>strongly recommended to explicitly close such objects. The
>`try...finally' statement provides a convenient way to do this.
If this isn't clear enough, we could revise it for the next release of
the documentation. As Guido said, the code is broken, not JPython.