[Python-3000] Pre-PEP: Simple input built-in in Python 3000
brett at python.org
Fri Dec 22 21:20:21 CET 2006
On 12/22/06, Steven Bethard <steven.bethard at gmail.com> wrote:
> On 12/22/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> > Andre Roberge wrote:
> > > The various possibilities mentioned in various forums include:
> > >
> > > ask()
> > > ask_user()
> > > get_string()
> > > input() # rejected by BDFL
> > > prompt()
> > > read()
> > > user_input()
> > > get_response()
> > why not call it "readline", and define it as
> > import sys
> > def readline():
> > return sys.stdin.readline()
> > ?
> > if you include the definition in the docstring, you get a nice little
> > lead-in to a discussion about modules and object access syntax.
> +1. This also makes it clearer that a whole line is read in. So if
> you want to, say, read a single character at a time (a frequent c.l.py
> question) you'll know you have to do something else.
+1 from me as well, although as Ron suggested, you probably want to
strip off the newline if we are targetting this to new programmers.
More information about the Python-3000