A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2008-January/076586.html below:

[Python-Dev] Incorrect documentation of the raw_input built-in function

[Python-Dev] Incorrect documentation of the raw_input built-in function [Python-Dev] Incorrect documentation of the raw_input built-in functionGreg Ewing greg.ewing at canterbury.ac.nz
Mon Jan 28 09:35:35 CET 2008
Isaac Morland wrote:

> 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:
> $

No, it's probably using the C stdlib routine getpass(). From the man
page:

      The getpass() function displays a prompt to, and reads in a password
      from, /dev/tty.  If this file is not accessible, getpass() displays the
      prompt on the standard error output and reads from the standard input.

So it appears that the official Unix Way prefers using stderr
over stdout for prompting, if using the std files for it at all.

Writing to stdin would be wrong, since it's usually read-only, even
when connected to a terminal.

--
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4