[Edu-sig] Pre-PEP was: The fate of raw_input() in Python 3000
andre.roberge at gmail.com
Thu Sep 14 03:27:20 CEST 2006
Having had a look at the discussion on the Python-3000 mailing list, I thought
it was appropriate to write a draft PEP with the intent of eventually posting
it on the Python 3000 list for "serious" discussion/future decision.
This proposal could most certainly be strengthened, and the wording improved
by a native English speaker with stronger CS background than I have.
I have attempted
to follow the standard recommended format (including providing both a motivation
and rationale ... which seemed a bit redundant and an artificial split...)
Feel free to make comments for improvement and even take over the "ownership"
of this PEP.
Title: Simple input built-in in Python 3000
Version: $Revision: 0.1 $
Last-Modified: $Date: 2006/09/13 20:00:00 $
Author: André Roberge <andre.roberge at gmail.com>
Type: Standards Track
Input and output are core features of computer programs. Currently,
Python provides a simple means of output through the print keyword
and two simple means of input throught the input() and raw_input()
Python 3.0 will introduces various incompatible changes with previous
Python versions. Among the proposed changes, print will become a built-in
function, print(), while input() and raw_input() would be removed completely
from the built-in namespace, requiring importing some module to provide
even the most basic input capability.
This PEP proposes that Python 3.0 retains some simple user input capability,
equivalent to raw_input(), within the built-in namespace.
With its easy readability and its support for many programming styles
(e.g. procedural, object-oriented, etc.) among others, Python is perhaps
the best computer language to use in introductory programming classes.
Simple programs most often need to contain a means to provide information to
a user (output) as well as obtaining information from that user (input).
Any computer language intended to be used in an educational setting should
provide straightforward methods for both input and output.
The current proposals for Python 3.0  include a simple output pathway
via a built-in function named print(), but a more complicated method for
input [e.g. via sys.stdin.readline()], one that requires importing an external
module. Current versions of Python (pre-3.0) include raw_input() as a built-in
function. With the availability of such a function, programs that
input/output can be written from day one, without requiring discussions of
importing modules, streams, etc.
Current built-in functions, like input() and raw_input(), are found to be
extremely useful in traditional teaching settings. (For more details,
see the discussion that followed .) While the BDFL has clearly stated 
that input() was not to be kept in Python 3000, he has also stated that he
was not against revising the decision of killing raw_input().
raw_input() provides a simple mean to ask a question and obtain information
from a user. The proposed plans for Python 3.0 would require the replacement
of the single statement
speed = raw_input("What is the average airspeed velocity of an unladed
by the more complicated
print("What is the average airspeed velocity of an unladed swallow?")
speed = sys.stdin.readline()
The removal of raw_input (or equivalent) would not significantly reduce the
built-in namespace while it would steepen significantly the learning
curve for beginners.
The built-in input function should be totally equivalent to the existing
With input() effectively removed from the language, the name raw_input()
makes much less sense and alternatives should be considered. The
various possibilities mentioned in various forums include:
input() # rejected by Guido
..  Miscellaneous Python 3.0 Plans
.. The fate of raw_input() in Python 3000
..  educational aspects of Python 3000
This document has been placed in the public domain.
More information about the Edu-sig