[Python-3000-checkins] r59283 - in python/branches/py3k/Doc: library/crypt.rst library/smtplib.rst library/telnetlib.rst library/termios.rst library/traceback.rst tutorial/stdlib2.rst

georg.brandl python-3000-checkins at python.org
Sun Dec 2 23:48:17 CET 2007


Author: georg.brandl
Date: Sun Dec  2 23:48:17 2007
New Revision: 59283

Modified:
   python/branches/py3k/Doc/library/crypt.rst
   python/branches/py3k/Doc/library/smtplib.rst
   python/branches/py3k/Doc/library/telnetlib.rst
   python/branches/py3k/Doc/library/termios.rst
   python/branches/py3k/Doc/library/traceback.rst
   python/branches/py3k/Doc/tutorial/stdlib2.rst
Log:
Remove all definitions of raw_input() that were still scattered throughout the docs
from the time where there was neither input() nor raw_input().


Modified: python/branches/py3k/Doc/library/crypt.rst
==============================================================================
--- python/branches/py3k/Doc/library/crypt.rst	(original)
+++ python/branches/py3k/Doc/library/crypt.rst	Sun Dec  2 23:48:17 2007
@@ -47,14 +47,8 @@
 
    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 == '*': 

Modified: python/branches/py3k/Doc/library/smtplib.rst
==============================================================================
--- python/branches/py3k/Doc/library/smtplib.rst	(original)
+++ python/branches/py3k/Doc/library/smtplib.rst	Sun Dec  2 23:48:17 2007
@@ -306,14 +306,8 @@
 
    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 @@
           % (fromaddr, ", ".join(toaddrs)))
    while True:
        try:
-           line = raw_input()
+           line = input()
        except EOFError:
            break
        if not line:

Modified: python/branches/py3k/Doc/library/telnetlib.rst
==============================================================================
--- python/branches/py3k/Doc/library/telnetlib.rst	(original)
+++ python/branches/py3k/Doc/library/telnetlib.rst	Sun Dec  2 23:48:17 2007
@@ -211,16 +211,10 @@
 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)

Modified: python/branches/py3k/Doc/library/termios.rst
==============================================================================
--- python/branches/py3k/Doc/library/termios.rst	(original)
+++ python/branches/py3k/Doc/library/termios.rst	Sun Dec  2 23:48:17 2007
@@ -90,12 +90,6 @@
 :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 @@
        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

Modified: python/branches/py3k/Doc/library/traceback.rst
==============================================================================
--- python/branches/py3k/Doc/library/traceback.rst	(original)
+++ python/branches/py3k/Doc/library/traceback.rst	Sun Dec  2 23:48:17 2007
@@ -143,7 +143,7 @@
    import sys, traceback
 
    def run_user_code(envdir):
-       source = raw_input(">>> ")
+       source = input(">>> ")
        try:
            exec(source, envdir)
        except:

Modified: python/branches/py3k/Doc/tutorial/stdlib2.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/stdlib2.rst	(original)
+++ python/branches/py3k/Doc/tutorial/stdlib2.rst	Sun Dec  2 23:48:17 2007
@@ -104,16 +104,11 @@
 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)


More information about the Python-3000-checkins mailing list