Commit 46334481 authored by Collin Winter's avatar Collin Winter

Change instances of 'while 1:' in the docs into 'while True:'.

parent 4c6a140b
...@@ -377,7 +377,7 @@ value returned to constants such as :const:`curses.KEY_PPAGE`, ...@@ -377,7 +377,7 @@ value returned to constants such as :const:`curses.KEY_PPAGE`,
:const:`curses.KEY_HOME`, or :const:`curses.KEY_LEFT`. Usually the main loop of :const:`curses.KEY_HOME`, or :const:`curses.KEY_LEFT`. Usually the main loop of
your program will look something like this:: your program will look something like this::
while 1: while True:
c = stdscr.getch() c = stdscr.getch()
if c == ord('p'): PrintDocument() if c == ord('p'): PrintDocument()
elif c == ord('q'): break # Exit the while() elif c == ord('q'): break # Exit the while()
......
...@@ -142,7 +142,7 @@ attribute:: ...@@ -142,7 +142,7 @@ attribute::
if fileitem.file: if fileitem.file:
# It's an uploaded file; count lines # It's an uploaded file; count lines
linecount = 0 linecount = 0
while 1: while True:
line = fileitem.file.readline() line = fileitem.file.readline()
if not line: break if not line: break
linecount = linecount + 1 linecount = linecount + 1
......
...@@ -783,7 +783,7 @@ module. Here is a basic working example:: ...@@ -783,7 +783,7 @@ module. Here is a basic working example::
followed by the LogRecord in pickle format. Logs the record followed by the LogRecord in pickle format. Logs the record
according to whatever policy is configured locally. according to whatever policy is configured locally.
""" """
while 1: while True:
chunk = self.connection.recv(4) chunk = self.connection.recv(4)
if len(chunk) < 4: if len(chunk) < 4:
break break
......
...@@ -322,7 +322,7 @@ example doesn't do any processing of the :rfc:`822` headers. In particular, the ...@@ -322,7 +322,7 @@ example doesn't do any processing of the :rfc:`822` headers. In particular, the
# Add the From: and To: headers at the start! # Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\n\r\n" msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, ", ".join(toaddrs))) % (fromaddr, ", ".join(toaddrs)))
while 1: while True:
try: try:
line = raw_input() line = raw_input()
except EOFError: except EOFError:
......
...@@ -734,7 +734,7 @@ The first two examples support IPv4 only. :: ...@@ -734,7 +734,7 @@ The first two examples support IPv4 only. ::
s.listen(1) s.listen(1)
conn, addr = s.accept() conn, addr = s.accept()
print('Connected by', addr) print('Connected by', addr)
while 1: while True:
data = conn.recv(1024) data = conn.recv(1024)
if not data: break if not data: break
conn.send(data) conn.send(data)
...@@ -788,7 +788,7 @@ sends traffic to the first one connected successfully. :: ...@@ -788,7 +788,7 @@ sends traffic to the first one connected successfully. ::
sys.exit(1) sys.exit(1)
conn, addr = s.accept() conn, addr = s.accept()
print('Connected by', addr) print('Connected by', addr)
while 1: while True:
data = conn.recv(1024) data = conn.recv(1024)
if not data: break if not data: break
conn.send(data) conn.send(data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment