Antoine Pitrou <pit...@free.fr> added the comment: > 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10093> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com