nntplib, huge xover object

Mel Wilson mwilson at the-wire.com
Mon Apr 7 08:26:24 EDT 2003


In article <x7smsvh7kr.fsf at guru.mired.org>, Mike Meyer <mwm at mired.org> wrote:
>Robin Munn <rmunn at pobox.com> writes:
>>     xover(start, end, open('foo.txt', 'w'))
>>
>> See? File-like object gets created, passed to your function, and then
>> automatically garbage-collected (and thus closed) when your function
>> returns.
>
>The garbage collection happening when your function returns is
>implementation specific. It works that way in CPython, but not
>Jython. You should always explicitly close files to make sure they get
>closed - and the output flushed, in this case - when you're done with
>them.

   That's why I prefer to think of Jython as a different
language.  The idea of a service that can clean up and quit
when the last client stops using it is just too appealing.

        Regards.        Mel.




More information about the Python-list mailing list