summaryrefslogtreecommitdiffstats
path: root/Doc/tut
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-08-21 04:54:00 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-08-21 04:54:00 (GMT)
commita6e16a86c47b151151c1ef6fcb5feb51543e7feb (patch)
treef2aeb746b769fac6fea925ec6e87e9821fce962c /Doc/tut
parent80d21af614038a3163b1def661a5087735865395 (diff)
downloadcpython-a6e16a86c47b151151c1ef6fcb5feb51543e7feb.zip
cpython-a6e16a86c47b151151c1ef6fcb5feb51543e7feb.tar.gz
cpython-a6e16a86c47b151151c1ef6fcb5feb51543e7feb.tar.bz2
Replace all cases of "while 1" with "while True".
Though slightly slower, has better clarity and teaching value.
Diffstat (limited to 'Doc/tut')
-rw-r--r--Doc/tut/tut.tex14
1 files changed, 7 insertions, 7 deletions
diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex
index 4bc571a..1990ab8 100644
--- a/Doc/tut/tut.tex
+++ b/Doc/tut/tut.tex
@@ -1215,7 +1215,7 @@ program requires no action.
For example:
\begin{verbatim}
->>> while 1:
+>>> while True:
... pass # Busy-wait for keyboard interrupt
...
\end{verbatim}
@@ -1358,7 +1358,7 @@ arguments than it is defined
\begin{verbatim}
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
- while 1:
+ while True:
ok = raw_input(prompt)
if ok in ('y', 'ye', 'yes'): return 1
if ok in ('n', 'no', 'nop', 'nope'): return 0
@@ -3076,10 +3076,10 @@ Syntax errors, also known as parsing errors, are perhaps the most common
kind of complaint you get while you are still learning Python:
\begin{verbatim}
->>> while 1 print 'Hello world'
+>>> while True print 'Hello world'
File "<stdin>", line 1, in ?
- while 1 print 'Hello world'
- ^
+ while True print 'Hello world'
+ ^
SyntaxError: invalid syntax
\end{verbatim}
@@ -3149,7 +3149,7 @@ supports); note that a user-generated interruption is signalled by
raising the \exception{KeyboardInterrupt} exception.
\begin{verbatim}
->>> while 1:
+>>> while True:
... try:
... x = int(raw_input("Please enter a number: "))
... break
@@ -3760,7 +3760,7 @@ later time. For example:
\begin{verbatim}
xf = x.f
-while 1:
+while True:
print xf()
\end{verbatim}