-h is used to print in stderr too, as you see here from main.c
usage(int exitcode, char* program) { fprintf(stderr, usage_line, program); fprintf(stderr, usage_top); fprintf(stderr, usage_mid); fprintf(stderr, usage_bot, DELIM, DELIM, PYTHONHOMEHELP); exit(exitcode); } ... if (help) usage(0, argv[0]); if (version) { fprintf(stderr, "Python %s\n", PY_VERSION); exit(0);
Current main.c has changed the way it is used
usage(int exitcode, char* program) { FILE *f = exitcode ? stderr : stdout; fprintf(f, usage_line, program); if (exitcode) fprintf(f, "Try `python -h' for more information.\n"); else { fputs(usage_1, f); fputs(usage_2, f); fputs(usage_3, f); fprintf(f, usage_4, DELIM); fprintf(f, usage_5, DELIM, PYTHONHOMEHELP); }
So usage uses stdout for -h and stderr for -Q.
I see no evidence of a good reason in one of the other ways. Perhaps it cannot be changed now without breaking backward compatibility.
John la rooy
source share