summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/optparse.rst29
-rw-r--r--Doc/library/os.rst14
-rw-r--r--Doc/library/sqlite3.rst34
-rw-r--r--Doc/library/xml.sax.utils.rst6
-rw-r--r--Doc/library/zipfile.rst3
5 files changed, 80 insertions, 6 deletions
diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst
index e6668b6..1b1b8ba 100644
--- a/Doc/library/optparse.rst
+++ b/Doc/library/optparse.rst
@@ -535,6 +535,35 @@ help message:
default value. If an option has no default value (or the default value is
``None``), ``%default`` expands to ``none``.
+When dealing with many options, it is convenient to group these
+options for better help output. An :class:`OptionParser` can contain
+several option groups, each of which can contain several options.
+
+Continuing with the parser defined above, adding an
+:class:`OptionGroup` to a parser is easy::
+
+ group = OptionGroup(parser, "Dangerous Options",
+ "Caution: use these options at your own risk. "
+ "It is believed that some of them bite.")
+ group.add_option("-g", action="store_true", help="Group option.")
+ parser.add_option_group(group)
+
+This would result in the following help output::
+
+ usage: [options] arg1 arg2
+
+ options:
+ -h, --help show this help message and exit
+ -v, --verbose make lots of noise [default]
+ -q, --quiet be vewwy quiet (I'm hunting wabbits)
+ -fFILE, --file=FILE write output to FILE
+ -mMODE, --mode=MODE interaction mode: one of 'novice', 'intermediate'
+ [default], 'expert'
+
+ Dangerous Options:
+ Caution: use of these options is at your own risk. It is believed that
+ some of them bite.
+ -g Group option.
.. _optparse-printing-version-string:
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index c4f6e64..66316dd 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -378,6 +378,20 @@ by file descriptors.
:func:`fdopen`, use its :meth:`close` method.
+.. function:: closerange(fd_low, fd_high)
+
+ Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive),
+ ignoring errors. Availability: Macintosh, Unix, Windows. Equivalent to::
+
+ for fd in xrange(fd_low, fd_high):
+ try:
+ os.close(fd)
+ except OSError:
+ pass
+
+ .. versionadded:: 2.6
+
+
.. function:: device_encoding(fd)
Return a string describing the encoding of the device associated with *fd*
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 9d12d34..02c2fa4 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -1,4 +1,3 @@
-
:mod:`sqlite3` --- DB-API 2.0 interface for SQLite databases
============================================================
@@ -387,7 +386,7 @@ A :class:`Cursor` instance has the following attributes and methods:
.. method:: Cursor.execute(sql, [parameters])
- Executes a SQL statement. The SQL statement may be parametrized (i. e.
+ Executes an SQL statement. The SQL statement may be parametrized (i. e.
placeholders instead of SQL literals). The :mod:`sqlite3` module supports two
kinds of placeholders: question marks (qmark style) and named placeholders
(named style).
@@ -408,7 +407,7 @@ A :class:`Cursor` instance has the following attributes and methods:
.. method:: Cursor.executemany(sql, seq_of_parameters)
- Executes a SQL command against all parameter sequences or mappings found in
+ Executes an SQL command against all parameter sequences or mappings found in
the sequence *sql*. The :mod:`sqlite3` module also allows using an
:term:`iterator` yielding parameters instead of a sequence.
@@ -432,6 +431,35 @@ A :class:`Cursor` instance has the following attributes and methods:
.. literalinclude:: ../includes/sqlite3/executescript.py
+.. method:: Cursor.fetchone()
+
+ Fetches the next row of a query result set, returning a single sequence,
+ or ``None`` when no more data is available.
+
+
+.. method:: Cursor.fetchmany([size=cursor.arraysize])
+
+ Fetches the next set of rows of a query result, returning a list. An empty
+ list is returned when no more rows are available.
+
+ The number of rows to fetch per call is specified by the *size* parameter.
+ If it is not given, the cursor's arraysize determines the number of rows
+ to be fetched. The method should try to fetch as many rows as indicated by
+ the size parameter. If this is not possible due to the specified number of
+ rows not being available, fewer rows may be returned.
+
+ Note there are performance considerations involved with the *size* parameter.
+ For optimal performance, it is usually best to use the arraysize attribute.
+ If the *size* parameter is used, then it is best for it to retain the same
+ value from one :meth:`fetchmany` call to the next.
+
+.. method:: Cursor.fetchall()
+
+ Fetches all (remaining) rows of a query result, returning a list. Note that
+ the cursor's arraysize attribute can affect the performance of this operation.
+ An empty list is returned when no rows are available.
+
+
.. attribute:: Cursor.rowcount
Although the :class:`Cursor` class of the :mod:`sqlite3` module implements this
diff --git a/Doc/library/xml.sax.utils.rst b/Doc/library/xml.sax.utils.rst
index cd16348..43bf69e 100644
--- a/Doc/library/xml.sax.utils.rst
+++ b/Doc/library/xml.sax.utils.rst
@@ -19,7 +19,8 @@ or as base classes.
You can escape other strings of data by passing a dictionary as the optional
*entities* parameter. The keys and values must all be strings; each key will be
- replaced with its corresponding value.
+ replaced with its corresponding value. The characters ``'&'``, ``'<'`` and
+ ``'>'`` are always escaped, even if *entities* is provided.
.. function:: unescape(data[, entities])
@@ -28,7 +29,8 @@ or as base classes.
You can unescape other strings of data by passing a dictionary as the optional
*entities* parameter. The keys and values must all be strings; each key will be
- replaced with its corresponding value.
+ replaced with its corresponding value. ``'&amp'``, ``'&lt;'``, and ``'&gt;'``
+ are always unescaped, even if *entities* is provided.
.. function:: quoteattr(data[, entities])
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index f647bca..c90f946 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -19,7 +19,8 @@ added to individual archive members---for which see the :ref:`zipinfo-objects`
documentation). It can handle ZIP files that use the ZIP64 extensions
(that is ZIP files that are more than 4 GByte in size). It supports
decryption of encrypted files in ZIP archives, but it currently cannot
-create an encrypted file.
+create an encrypted file. Decryption is extremely slow as it is
+implemented in native python rather than C.
For other archive formats, see the :mod:`bz2`, :mod:`gzip`, and
:mod:`tarfile` modules.