[Python-Dev] Incorrect documentation of the raw_input built-in function (original) (raw)

Isaac Morland ijmorlan at cs.uwaterloo.ca
Thu Jan 24 18:36:51 CET 2008


On Thu, 24 Jan 2008, skip at pobox.com wrote:

Mike> 2. Is this really the hard-coded behavior we want? I don't think Mike> my use-case is that odd; in fact, what I find very odd is that Mike> the prompt output is send to stderr. I mean, I'm printing the Mike> prompt for a question, not some error message. Can there not at Mike> least be an optional parameter to indicate that you want the Mike> output sent to stdout rather than stderr?

I can think of situations where you don't want the output to go to stdout either (suppose it's the regular output of the file you want to save to a file). Having a choice seems the best route.

What about an option (maybe even a default) to send the prompt to stdin?

The Postgres command line interface psql appears to do this:

$ psql 2>&1 >/dev/null Password: $

(I typed my password and then I quit by typing ^D; if I type the wrong password, it looks the same on screen but it quits right away without waiting for ^D)

I think ssh also does this when it needs to prompt for a password.

Really the prompt is part of the input, not part of the output, in a certain sense. Have people actually verified that the prompt is really sent to stderr right now by using 2>/dev/null to attempt to suppress it?

Isaac Morland CSCF Web Guru DC 2554C, x36650 WWW Software Specialist



More information about the Python-Dev mailing list