diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 9c2e3a69f25..7129df50d68 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -157,9 +157,9 @@ The following exceptions are the exceptions that are actually raised. .. exception:: IndexError - Raised when a sequence subscript is out of range. (Slice indices are silently - truncated to fall in the allowed range; if an index is not a plain integer, - :exc:`TypeError` is raised.) + Raised when a sequence subscript is out of range. (Slice indices are + silently truncated to fall in the allowed range; if an index is not an + integer, :exc:`TypeError` is raised.) .. XXX xref to sequences @@ -282,10 +282,10 @@ The following exceptions are the exceptions that are actually raised. This exception is raised by the :func:`sys.exit` function. When it is not handled, the Python interpreter exits; no stack traceback is printed. If the - associated value is a plain integer, it specifies the system exit status (passed - to C's :cfunc:`exit` function); if it is ``None``, the exit status is zero; if - it has another type (such as a string), the object's value is printed and the - exit status is one. + associated value is an integer, it specifies the system exit status (passed + to C's :cfunc:`exit` function); if it is ``None``, the exit status is zero; + if it has another type (such as a string), the object's value is printed and + the exit status is one. Instances have an attribute :attr:`code` which is set to the proposed exit status or error message (defaulting to ``None``). Also, this exception derives diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index ff6069d74f2..468998548bd 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -429,13 +429,13 @@ are always available. They are listed here in alphabetical order. .. function:: float([x]) - Convert a string or a number to floating point. If the argument is a string, it - must contain a possibly signed decimal or floating point number, possibly - embedded in whitespace. The argument may also be [+|-]nan or [+|-]inf. - Otherwise, the argument may be a plain integer - or a floating point number, and a floating point number with the same value - (within Python's floating point precision) is returned. If no argument is - given, returns ``0.0``. + Convert a string or a number to floating point. If the argument is a string, + it must contain a possibly signed decimal or floating point number, possibly + embedded in whitespace. The argument may also be ``'[+|-]nan'`` or + ``'[+|-]inf'``. Otherwise, the argument may be an integer or a floating + point number, and a floating point number with the same value (within + Python's floating point precision) is returned. If no argument is given, + ``0.0`` is returned. .. note:: @@ -443,11 +443,12 @@ are always available. They are listed here in alphabetical order. single: NaN single: Infinity - When passing in a string, values for NaN and Infinity may be returned, depending - on the underlying C library. Float accepts the strings nan, inf and -inf for - NaN and positive or negative infinity. The case and a leading + are ignored as - well as a leading - is ignored for NaN. Float always represents NaN and infinity - as nan, inf or -inf. + When passing in a string, values for NaN and Infinity may be returned, + depending on the underlying C library. Float accepts the strings + ``'nan'``, ``'inf'`` and ``'-inf'`` for NaN and positive or negative + infinity. The case and a leading + are ignored as well as a leading - is + ignored for NaN. Float always represents NaN and infinity as ``nan``, + ``inf`` or ``-inf``. The float type is described in :ref:`typesnumeric`. @@ -873,15 +874,15 @@ are always available. They are listed here in alphabetical order. .. XXX does accept objects with __index__ too .. function:: range([start,] stop[, step]) - This is a versatile function to create lists containing arithmetic progressions. - It is most often used in :keyword:`for` loops. The arguments must be plain - integers. If the *step* argument is omitted, it defaults to ``1``. If the - *start* argument is omitted, it defaults to ``0``. The full form returns a list - of plain integers ``[start, start + step, start + 2 * step, ...]``. If *step* - is positive, the last element is the largest ``start + i * step`` less than - *stop*; if *step* is negative, the last element is the smallest ``start + i * - step`` greater than *stop*. *step* must not be zero (or else :exc:`ValueError` - is raised). Example: + This is a versatile function to create iterators yielding arithmetic + progressions. It is most often used in :keyword:`for` loops. The arguments + must be integers. If the *step* argument is omitted, it defaults to ``1``. + If the *start* argument is omitted, it defaults to ``0``. The full form + returns an iterator of integers ``[start, start + step, start + 2 * step, + ...]``. If *step* is positive, the last element is the largest ``start + i * + step`` less than *stop*; if *step* is negative, the last element is the + smallest ``start + i * step`` greater than *stop*. *step* must not be zero + (or else :exc:`ValueError` is raised). Example: >>> list(range(10)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst index c5c69a4976b..5f770f6339e 100644 --- a/Doc/library/profile.rst +++ b/Doc/library/profile.rst @@ -598,7 +598,7 @@ The resulting profiler will then call :func:`your_time_func`. timer call, along with the appropriate calibration constant. :class:`cProfile.Profile` - :func:`your_time_func` should return a single number. If it returns plain + :func:`your_time_func` should return a single number. If it returns integers, you can also invoke the class constructor with a second argument specifying the real duration of one unit of time. For example, if :func:`your_integer_time_func` returns times measured in thousands of seconds, diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index c97e9ae81e6..42591879a40 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -218,7 +218,7 @@ Numeric Types --- :class:`int`, :class:`float`, :class:`complex` There are three distinct numeric types: :dfn:`integers`, :dfn:`floating point numbers`, and :dfn:`complex numbers`. In addition, Booleans are a subtype of -plain integers. Integers have unlimited precision. Floating point numbers are +integers. Integers have unlimited precision. Floating point numbers are implemented using :ctype:`double` in C. All bets on their precision are off unless you happen to know the machine you are working with. diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 1e33fa3ecc4..3912d1efc14 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -172,10 +172,7 @@ Ellipsis There are two types of integers: - Plain integers - .. index:: - object: plain integer - single: OverflowError (built-in exception) + Integers These represent numbers in an unlimited range, subject to available (virtual) memory only. For the purpose of shift and mask operations, a binary @@ -191,7 +188,7 @@ Ellipsis These represent the truth values False and True. The two objects representing the values False and True are the only Boolean objects. The Boolean type is a - subtype of plain integers, and Boolean values behave like the values 0 and 1, + subtype of the integer type, and Boolean values behave like the values 0 and 1, respectively, in almost all contexts, the exception being that when converted to a string, the strings ``"False"`` or ``"True"`` are returned, respectively. diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index a5e858bddbc..af79e534c94 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -821,9 +821,9 @@ The unary ``+`` (plus) operator yields its numeric argument unchanged. .. index:: single: inversion -The unary ``~`` (invert) operator yields the bitwise inversion of its plain or -long integer argument. The bitwise inversion of ``x`` is defined as -``-(x+1)``. It only applies to integral numbers. +The unary ``~`` (invert) operator yields the bitwise inversion of its integer +argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. It only +applies to integral numbers. .. index:: exception: TypeError diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst index 5748b9e2f7c..fdb5f99bdd6 100644 --- a/Doc/reference/lexical_analysis.rst +++ b/Doc/reference/lexical_analysis.rst @@ -565,9 +565,9 @@ Numeric literals floating point literal, hexadecimal literal octal literal, binary literal, decimal literal, imaginary literal, complex literal -There are three types of numeric literals: plain integers, floating point -numbers, and imaginary numbers. There are no complex literals -(complex numbers can be formed by adding a real number and an imaginary number). +There are three types of numeric literals: integers, floating point numbers, and +imaginary numbers. There are no complex literals (complex numbers can be formed +by adding a real number and an imaginary number). Note that numeric literals do not include a sign; a phrase like ``-1`` is actually an expression composed of the unary operator '``-``' and the literal