]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Remove all definitions of raw_input() that were still scattered throughout the docs
authorGeorg Brandl <georg@python.org>
Sun, 2 Dec 2007 22:48:17 +0000 (22:48 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 2 Dec 2007 22:48:17 +0000 (22:48 +0000)
from the time where there was neither input() nor raw_input().

Doc/library/crypt.rst
Doc/library/smtplib.rst
Doc/library/telnetlib.rst
Doc/library/termios.rst
Doc/library/traceback.rst
Doc/tutorial/stdlib2.rst

index 8840fc7ea7ede9757015640ef453eeec80fd490f..7e0cb9c0f2709aa028f67910919968cdcd3160fe 100644 (file)
@@ -47,14 +47,8 @@ A simple example illustrating typical use::
 
    import crypt, getpass, pwd
 
-   def raw_input(prompt):
-       import sys
-       sys.stdout.write(prompt)
-       sys.stdout.flush()
-       return sys.stdin.readline()
-
    def login():
-       username = raw_input('Python login:')
+       username = input('Python login:')
        cryptedpasswd = pwd.getpwnam(username)[1]
        if cryptedpasswd:
            if cryptedpasswd == 'x' or cryptedpasswd == '*': 
index 0653a5035915e63284c4f0e4204742a2f64dd356..790cacb5eb2845267e854c122b73447f7cdacdf8 100644 (file)
@@ -306,14 +306,8 @@ example doesn't do any processing of the :rfc:`822` headers.  In particular, the
 
    import smtplib
 
-   def raw_input(prompt):
-       import sys
-       sys.stdout.write(prompt)
-       sys.stdout.flush()
-       return sys.stdin.readline()
-
    def prompt(prompt):
-       return raw_input(prompt).strip()
+       return input(prompt).strip()
 
    fromaddr = prompt("From: ")
    toaddrs  = prompt("To: ").split()
@@ -324,7 +318,7 @@ example doesn't do any processing of the :rfc:`822` headers.  In particular, the
           % (fromaddr, ", ".join(toaddrs)))
    while True:
        try:
-           line = raw_input()
+           line = input()
        except EOFError:
            break
        if not line:
index 5cfca9a0ad2a64933f41435fc92b209494da3c4b..7f08e70f70f4806f9eca7021aa28479d3d362712 100644 (file)
@@ -211,16 +211,10 @@ Telnet Example
 A simple example illustrating typical use::
 
    import getpass
-   import sys
    import telnetlib
 
-   def raw_input(prompt):
-       sys.stdout.write(prompt)
-       sys.stdout.flush()
-       return sys.stdin.readline()
-
    HOST = "localhost"
-   user = raw_input("Enter your remote account: ")
+   user = input("Enter your remote account: ")
    password = getpass.getpass()
 
    tn = telnetlib.Telnet(HOST)
index 695faade06f101c8445adb12e84f64b67932e10a..54fb0651ccf0e34f8f01af60810cd060628d8527 100644 (file)
@@ -90,12 +90,6 @@ technique using a separate :func:`tcgetattr` call and a :keyword:`try` ...
 :keyword:`finally` statement to ensure that the old tty attributes are restored
 exactly no matter what happens::
 
-   def raw_input(prompt):
-       import sys
-       sys.stdout.write(prompt)
-       sys.stdout.flush()
-       return sys.stdin.readline()
-
    def getpass(prompt = "Password: "):
        import termios, sys
        fd = sys.stdin.fileno()
@@ -104,7 +98,7 @@ exactly no matter what happens::
        new[3] = new[3] & ~termios.ECHO          # lflags
        try:
            termios.tcsetattr(fd, termios.TCSADRAIN, new)
-           passwd = raw_input(prompt)
+           passwd = input(prompt)
        finally:
            termios.tcsetattr(fd, termios.TCSADRAIN, old)
        return passwd
index 9b96743d3210112fa23b5b96b12d2dd45c0bd044..ca8aea3b4840c30d2385a17c2d23e0ed15dabed0 100644 (file)
@@ -143,7 +143,7 @@ module. ::
    import sys, traceback
 
    def run_user_code(envdir):
-       source = raw_input(">>> ")
+       source = input(">>> ")
        try:
            exec(source, envdir)
        except:
index 17fb867ee981db34a8341382aeb5d96cb4708658..4e8d37e52181670a711e566e2edbdc2f663b6bc2 100644 (file)
@@ -104,16 +104,11 @@ Template subclasses can specify a custom delimiter.  For example, a batch
 renaming utility for a photo browser may elect to use percent signs for
 placeholders such as the current date, image sequence number, or file format::
 
-   >>> import time, os.path, sys
-   >>> def raw_input(prompt):
-   ...     sys.stdout.write(prompt)
-   ...     sys.stdout.flush()
-   ...     return sys.stdin.readline()
-   ... 
+   >>> import time, os.path
    >>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']
    >>> class BatchRename(Template):
    ...     delimiter = '%'
-   >>> fmt = raw_input('Enter rename style (%d-date %n-seqnum %f-format):  ')
+   >>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format):  ')
    Enter rename style (%d-date %n-seqnum %f-format):  Ashley_%n%f
 
    >>> t = BatchRename(fmt)