From 51b72162b65151ea23281c6e2a31adafbc820a48 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 27 Oct 2009 13:54:57 +0000 Subject: [PATCH] Merged revisions 70171,70183,70290,70292,70315,70438,70464 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ........ r70171 | facundo.batista | 2009-03-04 22:18:17 +0100 (Mi, 04 Mär 2009) | 3 lines Fixed a typo. ........ r70183 | benjamin.peterson | 2009-03-05 01:17:57 +0100 (Do, 05 Mär 2009) | 1 line add example ........ r70290 | raymond.hettinger | 2009-03-10 02:07:30 +0100 (Di, 10 Mär 2009) | 1 line Update url for the spec. ........ r70292 | raymond.hettinger | 2009-03-10 05:40:24 +0100 (Di, 10 Mär 2009) | 1 line Clarify the meaning of normal and subnormal. ........ r70315 | raymond.hettinger | 2009-03-12 01:25:03 +0100 (Do, 12 Mär 2009) | 1 line Add reference to solution for a commonly asked question. ........ r70438 | benjamin.peterson | 2009-03-17 21:29:51 +0100 (Di, 17 Mär 2009) | 1 line I thought this was begging for an example ........ r70464 | benjamin.peterson | 2009-03-18 21:58:09 +0100 (Mi, 18 Mär 2009) | 1 line a much better example ........ --- Doc/library/decimal.rst | 12 ++++++++---- Doc/library/functions.rst | 8 ++++++++ Doc/library/struct.rst | 2 +- Doc/library/symtable.rst | 6 ++++++ Doc/reference/datamodel.rst | 3 +++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 7cd8952fa3..6e45e84721 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -108,7 +108,7 @@ reset them before monitoring a calculation. .. seealso:: * IBM's General Decimal Arithmetic Specification, `The General Decimal Arithmetic - Specification `_. + Specification `_. * IEEE standard 854-1987, `Unofficial IEEE 854 Text `_. @@ -531,8 +531,11 @@ Decimal objects .. method:: is_normal() - Return :const:`True` if the argument is a *normal* finite number. Return - :const:`False` if the argument is zero, subnormal, infinite or a NaN. + Return :const:`True` if the argument is a *normal* finite non-zero + number with an adjusted exponent greater than or equal to *Emin*. + Return :const:`False` if the argument is zero, subnormal, infinite or a + NaN. Note, the term *normal* is used here in a different sense with + the :meth:`normalize` method which is used to create canonical values. .. versionadded:: 2.6 @@ -560,7 +563,8 @@ Decimal objects .. method:: is_subnormal() Return :const:`True` if the argument is subnormal, and :const:`False` - otherwise. + otherwise. A number is subnormal is if it is nonzero, finite, and has an + adjusted exponent less than *Emin*. .. versionadded:: 2.6 diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index d716e97558..55f23b9579 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -603,6 +603,14 @@ available. They are listed here in alphabetical order. its :meth:`next` method; if the value returned is equal to *sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be returned. + One useful application of the second form of :func:`iter` is to read lines of + a file until a certain line is reached. The following example reads a file + until ``"STOP"`` is reached: :: + + with open("mydata.txt") as fp: + for line in iter(fp.readline, "STOP"): + process_line(line) + .. versionadded:: 2.2 diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index 63bf9b178e..d29bd7bb77 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -50,7 +50,7 @@ The module defines the following exception and functions: .. function:: unpack_from(fmt, buffer[,offset=0]) - Unpack the *buffer* according to tthe given format. The result is a tuple even + Unpack the *buffer* according to the given format. The result is a tuple even if it contains exactly one item. The *buffer* must contain at least the amount of data required by the format (``len(buffer[offset:])`` must be at least ``calcsize(fmt)``). diff --git a/Doc/library/symtable.rst b/Doc/library/symtable.rst index 28306e6736..9ea3f01b40 100644 --- a/Doc/library/symtable.rst +++ b/Doc/library/symtable.rst @@ -164,6 +164,12 @@ Examining Symbol Tables If the name is used as the target of a function or class statement, this will be true. + For example:: + + >>> table = symtable.symtable("def some_func(): pass", "string", "exec") + >>> table.lookup("some_func").is_namespace() + True + Note that a single name can be bound to multiple objects. If the result is ``True``, the name may also be bound to other objects, like an int or list, that does not introduce a new namespace. diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 7c52694781..5d612b814e 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1347,6 +1347,9 @@ Basic customization Arguments to rich comparison methods are never coerced. + To automatically generate ordering operations from a single root operation, + see the `Total Ordering recipe in the ASPN cookbook + `_\. .. method:: object.__cmp__(self, other) -- 2.50.1