summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/howto/urllib2.rst2
-rw-r--r--Doc/library/cgi.rst15
-rw-r--r--Doc/library/itertools.rst4
3 files changed, 11 insertions, 10 deletions
diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst
index 51978fc..fb5b1c3 100644
--- a/Doc/howto/urllib2.rst
+++ b/Doc/howto/urllib2.rst
@@ -492,7 +492,7 @@ than the URL you pass to .add_password() will also match. ::
.. note::
- In the above example we only supplied our ``HHTPBasicAuthHandler`` to
+ In the above example we only supplied our ``HTTPBasicAuthHandler`` to
``build_opener``. By default openers have the handlers for normal situations
-- ``ProxyHandler``, ``UnknownHandler``, ``HTTPHandler``,
``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``,
diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst
index 55f6509..03dfe2d 100644
--- a/Doc/library/cgi.rst
+++ b/Doc/library/cgi.rst
@@ -88,12 +88,13 @@ input or the environment (depending on the value of various environment
variables set according to the CGI standard). Since it may consume standard
input, it should be instantiated only once.
-The :class:`FieldStorage` instance can be indexed like a Python dictionary, and
-also supports the standard dictionary methods :meth:`__contains__` and
-:meth:`keys`. The built-in :func:`len` is also supported. Form fields
-containing empty strings are ignored and do not appear in the dictionary; to
-keep such values, provide a true value for the optional *keep_blank_values*
-keyword parameter when creating the :class:`FieldStorage` instance.
+The :class:`FieldStorage` instance can be indexed like a Python dictionary.
+It allows membership testing with the :keyword:`in` operator, and also supports
+the standard dictionary method :meth:`keys` and the built-in function
+:func:`len`. Form fields containing empty strings are ignored and do not appear
+in the dictionary; to keep such values, provide a true value for the optional
+*keep_blank_values* keyword parameter when creating the :class:`FieldStorage`
+instance.
For instance, the following code (which assumes that the
:mailheader:`Content-Type` header and blank line have already been printed)
@@ -101,7 +102,7 @@ checks that the fields ``name`` and ``addr`` are both set to a non-empty
string::
form = cgi.FieldStorage()
- if not ("name" in form and "addr" in form):
+ if "name" not in form or "addr" not in form:
print("<H1>Error</H1>")
print("Please fill in the name and addr fields.")
return
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index ac3b761..c1f8d9a 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -49,13 +49,13 @@ Iterator Arguments Results
:func:`chain` p, q, ... p0, p1, ... plast, q0, q1, ... ``chain('ABC', 'DEF') --> A B C D E F``
:func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F``
:func:`dropwhile` pred, seq seq[n], seq[n+1], starting when pred fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``
-:func:`filterfalse` pred, seq elements of seq where pred(elem) is False ``ifilterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
+:func:`filterfalse` pred, seq elements of seq where pred(elem) is False ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
:func:`groupby` iterable[, keyfunc] sub-iterators grouped by value of keyfunc(v)
:func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G``
:func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``
:func:`takewhile` pred, seq seq[0], seq[1], until pred fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``
:func:`tee` it, n it1, it2 , ... itn splits one iterator into n
-:func:`zip_longest` p, q, ... (p[0], q[0]), (p[1], q[1]), ... ``izip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``
+:func:`zip_longest` p, q, ... (p[0], q[0]), (p[1], q[1]), ... ``zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``
==================== ============================ ================================================= =============================================================
**Combinatoric generators:**