Message119871
> That's what I'm referring to: most Python applications are
> written with the fact in mind, that garbage collection will
> close the files or socket.
>
> That's a perfectly fine way of writing Python applications,
Some people would disagree, especially Windows users who cannot timely
delete files when some file descriptors still point to them.
> so why should the programmer get warned about this regular
> approach to Python programming ?
Again: it is an *optional* warning. It is *disabled* by default, except
when compiled --with-pydebug.
> The same applies for sockets.
It is *definitely* a mistake if the socket has been bound to a local
address and/or connected to a remote endpoint.
> Think of the simple idiom:
>
> data = open(filename).read()
>
> This would always create a warning under the proposal.
We have had many Windows buildbot failures because of such coding style.
> If you want to monitor resource usage in your application it
> would be a lot more useful to provide access to the number of
> currently open FDs
Agreed it would be useful as well, but please tell that to operating
system vendors. Python has no way to calculate such a statistic. |
|
Date |
User |
Action |
Args |
2010-10-29 08:22:36 | pitrou | set | recipients:
+ pitrou, lemburg, brett.cannon, exarkun, amaury.forgeotdarc, giampaolo.rodola, benjamin.peterson, alex, brian.curtin |
2010-10-29 08:22:35 | pitrou | link | issue10093 messages |
2010-10-29 08:22:34 | pitrou | create | |
|