]> granicus.if.org Git - python/commitdiff
stupid, stupid, stupid... raw_input() already supports readline() if the
authorSkip Montanaro <skip@pobox.com>
Mon, 24 May 2004 14:20:16 +0000 (14:20 +0000)
committerSkip Montanaro <skip@pobox.com>
Mon, 24 May 2004 14:20:16 +0000 (14:20 +0000)
readline module is loaded.

Doc/lib/libreadline.tex
Misc/NEWS
Modules/readline.c

index 34d3a4c06ff6c7175e550d596cea93f2f86fa407..d0b26a3bd61f4c9bea386729fb02614ff51f9daf 100644 (file)
@@ -15,10 +15,6 @@ interpreter.
 The \module{readline} module defines the following functions:
 
 
-\begin{funcdesc}{readline}{\optional{prompt}}
-Get a single line of input from the user.
-\end{funcdesc}
-
 \begin{funcdesc}{parse_and_bind}{string}
 Parse and execute single line of a readline init file.
 \end{funcdesc}
@@ -160,7 +156,7 @@ del os, histfile
 \end{verbatim}
 
 The following example extends the \class{code.InteractiveConsole} class to
-support command line editing and history save/restore.
+support history save/restore.
 
 \begin{verbatim}
 import code
@@ -183,12 +179,6 @@ class HistoryConsole(code.InteractiveConsole):
                 pass
             atexit.register(self.save_history, histfile)
 
-    def raw_input(self, prompt=""):
-        line = readline.readline(prompt)
-        if line:
-            readline.add_history(line)
-        return line
-
     def save_history(self, histfile):
         readline.write_history_file(histfile)
 \end{verbatim}
index b04495f8291b406784d79567f68f83317a610e17..7215483a329a7fb9ea8f446f4b79f3038326633e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -207,11 +207,6 @@ Core and builtins
 Extension modules
 -----------------
 
-- The readline module now exposes the readline() function to the Python
-  programmer.  readline.readline() should be a drop-in replacement for
-  raw_input() but coupled with the other readline module functionality allow
-  programmers to offer history and input recall to their users.
-
 - operator.isMappingType() and operator.isSequenceType() now give
   fewer false positives.
 
index 50ceef490539009ce755b7ad7754515d2d0f308f..37baf87e1fe5ca205f3763b7b6db29c9c9a7b252 100644 (file)
 #endif
 
 
-/* Exported function to get a line from the user */
-
-static PyObject *
-py_readline(PyObject *self, PyObject *args)
-{
-       char *s = NULL;
-       char *line = NULL;
-       if (!PyArg_ParseTuple(args, "|s:readline", &s))
-               return NULL;
-       line = readline(s);
-       if (line == NULL) {
-               PyErr_SetString(PyExc_EOFError, "End of file on input");
-               return NULL;
-       }
-       return PyString_FromString(line);
-}
-
-PyDoc_STRVAR(doc_py_readline,
-"readline([prompt]) -> line\n\
-Prompt for and read a line of text.  Raise EOFError on EOF.");
-
-
 /* Exported function to send one line to readline's init file parser */
 
 static PyObject *
@@ -490,7 +468,6 @@ contents of the line buffer.");
 
 static struct PyMethodDef readline_methods[] =
 {
-       {"readline", py_readline, METH_VARARGS, doc_py_readline},
        {"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind},
        {"get_line_buffer", get_line_buffer, METH_NOARGS, doc_get_line_buffer},
        {"insert_text", insert_text, METH_VARARGS, doc_insert_text},