On Tue, 2007-01-02 at 13:05 +0100, Hans Meine wrote:
> You close when the GC collects the object, which *may* be later than when 
> losing the reference.  In this case, this does not matter at all, but that's 
> the reason why file-like objects should *always* have a close() method - 
> otherwise there would be no way to make sure that it gets closed at a certain 
> time.

The GC is only relevant when there is a cyclic reference.  Otherwise the
object is dealloc'd as soon as its refcnt reaches 0.  Indeed when there
is a circular reference the object ought to be explicitly closed.

Maybe this is an issue with Jython, but with the standard C python I
don't see why an idiom like file(outfile, "w").write(data) isn't safe.

Cheers,
Jason.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to