Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Newbie question: does file("text.txt',"w").write("stuff") ever get closed?

Reply
Thread Tools

Re: Newbie question: does file("text.txt',"w").write("stuff") ever get closed?

 
 
Fredrik Lundh
Guest
Posts: n/a
 
      11-18-2005
"John Doe" <> wrote:

> In an effort to avoid another potential mistake, I am wondering if the
> anonymous file object/class/thingy that I create when I do file("text.txt',
> "w").write("stuff") gets closed properly on exit or garbage collection or
> something


yes.

> or if I always need to hang on to these things and close them myself.


only if you want to 1) know exactly when the files are closed, or 2) are
using so many files that the garbage collector cannot keep up with you
(this never happens on CPython, but can, at least in theory, happen on
other Python implementations)

</F>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get ubuntu ! Get ubuntu ! Get ubuntu ! Get ubuntu ! Getubuntu Windows 64bit 1 06-01-2009 08:54 AM
don't you ever, don't you ever, lower yourself, forgetting all your standards Jason ASP .Net Web Controls 0 07-06-2004 12:50 PM
Does scanf ever return EOF? hugo27 C Programming 7 06-21-2004 12:03 PM
Does anybody ever tried SysDB ? beji XML 0 09-08-2003 01:13 PM
Does anyone ever heard about quality assurance in helpdesks? Frédéric Computer Support 0 07-13-2003 05:26 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57