Wolfgang Maier added the comment:

Hi Julius,

I guess it's a question of control and responsibilities.
If you write a program that may issue warnings under some conditions, that 
program may, for example, be used with stderr redirected to a file. Now it is 
possible that file gets removed while your program is running, then, upon the 
next warning, the program would crash with an IOError. In effect, this would 
let external cirumstances that are not under control by the programmer escalate 
a non-critical warning message to a true exception. It's debatable whether that 
should be prevented or not, but that seems to be the decision that Mark Hammond 
made long ago.
If, OTOH, your program chooses to close sys.stderr, that is a deliberate 
decision and it's the programmers responsibility then not to try to write to it 
anymore. Suppressing the resulting ValueError would only hide the fact that due 
to a programming error no warnings can be issued anymore.
Not sure if this makes any sense to you or others, but that's how I came to 
think about this.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22298>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to