]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #23116: Improve ask_ok() example in the Python tutorial
authorBerker Peksag <berker.peksag@gmail.com>
Thu, 2 Jun 2016 18:31:19 +0000 (11:31 -0700)
committerBerker Peksag <berker.peksag@gmail.com>
Thu, 2 Jun 2016 18:31:19 +0000 (11:31 -0700)
Doc/tutorial/controlflow.rst

index 65f83bf38360f4cbc84bf328be90a411f95924f8..ddc08552ed70c67186fe09f7382c6afb62914e3f 100644 (file)
@@ -361,7 +361,7 @@ The most useful form is to specify a default value for one or more arguments.
 This creates a function that can be called with fewer arguments than it is
 defined to allow.  For example::
 
-   def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
+   def ask_ok(prompt, retries=4, reminder='Please try again!'):
        while True:
            ok = input(prompt)
            if ok in ('y', 'ye', 'yes'):
@@ -370,8 +370,8 @@ defined to allow.  For example::
                return False
            retries = retries - 1
            if retries < 0:
-               raise OSError('uncooperative user')
-           print(complaint)
+               raise ValueError('invalid user response')
+           print(reminder)
 
 This function can be called in several ways: