summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-06-29 15:00:34 (GMT)
committerFred Drake <fdrake@acm.org>2001-06-29 15:00:34 (GMT)
commitf7e504d89613517ff0356bb6591f14eaf956e312 (patch)
treec0bee01109ed18d9823e68bcf28c35fd86172a4e
parent62ebe047e4c0c07dd5cc6956c2344af4f60578ff (diff)
downloadcpython-f7e504d89613517ff0356bb6591f14eaf956e312.zip
cpython-f7e504d89613517ff0356bb6591f14eaf956e312.tar.gz
cpython-f7e504d89613517ff0356bb6591f14eaf956e312.tar.bz2
Simplify an example based on comment from Thomas Holenstein <thomas@hex.ch>:
Do not use an extra flag variable to test only once in one subsequent if statement.
-rw-r--r--Doc/lib/libcgi.tex5
1 files changed, 1 insertions, 4 deletions
diff --git a/Doc/lib/libcgi.tex b/Doc/lib/libcgi.tex
index 285c08f..8ab562d 100644
--- a/Doc/lib/libcgi.tex
+++ b/Doc/lib/libcgi.tex
@@ -89,10 +89,7 @@ non-empty string:
\begin{verbatim}
form = cgi.FieldStorage()
-form_ok = 0
-if form.has_key("name") and form.has_key("addr"):
- form_ok = 1
-if not form_ok:
+if not (form.has_key("name") and form.has_key("addr")):
print "<H1>Error</H1>"
print "Please fill in the name and addr fields."
return