Reputation: 1
For example:
python -V
Python 2.7.5
python -V 2>/dev/null
nothing
python -V 1>/dev/null
Python 2.7.5
When the standard output of 'python -V' is redirected to /dev/null, the output is'Python 2.7.5'. When the standard error of 'python -V' is redirected to /dev/null, the output is empty.
Upvotes: 0
Views: 68
Reputation: 6796
I doubt there is a better answer to this than "because whoever wrote that part of the code thought it was a good idea". For what it's worth, in Python 3 the -V output goes to standard output.
(You could argue that this type of output is not "normal" output, and therefore should go to stderr. You could also argue that, once the user has said -V, it is normal output and therefore should go to stdout. You could also argue that the stdout/stderr distinction becomes rather muddled when the program is an interpreter which runs another program, that has full control over where its output goes.)
Upvotes: 3