This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients alex, amaury.forgeotdarc, benjamin.peterson, brett.cannon, brian.curtin, exarkun, giampaolo.rodola, lemburg, pitrou
Date 2010-10-29.11:52:36
SpamBayes Score 9.284042e-06
Marked as misclassified No
Message-id <1288353153.3565.66.camel@localhost.localdomain>
In-reply-to <4CCAAD88.8090705@egenix.com>
Content
> Whether you write an application with automatic closing of
> the file/socket at garbage collection time in mind, or you explicitly
> close the file/socket, the timing is the same.

No, because objects can be kept alive through tracebacks (or reference
cycles).

> I don't follow you. Where's the difference between writing:
> 
> s.close()
> or
> s = None
> 
> for an open socket s ?

The difference is when s is still referenced elsewhere.
Also, the intent of the former is clear while the latter is deliberately
obscure (while not saving any significant amount of typing).

> The for-loop file iterator support was explicitly added to make
> writing:
> 
> for line in open(filename):
>     print line
> 
> possible.

So what?

> At least for Linux, that's not hard and I doubt it is for other OSes.
> 
> 4
> 
> On other Unixes, you can simply use fcntl() to scan all possible FDs
> for open FDs.
> 
> On Windows you can use one of these functions for the same effect:
> http://msdn.microsoft.com/en-us/library/kdfaxaay(v=VS.90).aspx

Until you post some code I won't understand what you are talking about.
History
Date User Action Args
2010-10-29 11:52:38pitrousetrecipients: + pitrou, lemburg, brett.cannon, exarkun, amaury.forgeotdarc, giampaolo.rodola, benjamin.peterson, alex, brian.curtin
2010-10-29 11:52:36pitroulinkissue10093 messages
2010-10-29 11:52:36pitroucreate