Message119889
> 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. |
|
Date |
User |
Action |
Args |
2010-10-29 11:52:38 | pitrou | set | recipients:
+ pitrou, lemburg, brett.cannon, exarkun, amaury.forgeotdarc, giampaolo.rodola, benjamin.peterson, alex, brian.curtin |
2010-10-29 11:52:36 | pitrou | link | issue10093 messages |
2010-10-29 11:52:36 | pitrou | create | |
|