mirror of
https://github.com/python/cpython.git
synced 2025-01-24 10:04:09 +08:00
Remove mentions of "long integer" in the docs.
Credits to HappySmileMan from GHOP.
This commit is contained in:
parent
0db38532b3
commit
ba956aebb9
@ -219,7 +219,7 @@ This module offers the following functions:
|
||||
| ``1`` | An integer giving the number of values this |
|
||||
| | key has. |
|
||||
+-------+---------------------------------------------+
|
||||
| ``2`` | A long integer giving when the key was last |
|
||||
| ``2`` | An integer giving when the key was last |
|
||||
| | modified (if available) as 100's of |
|
||||
| | nanoseconds since Jan 1, 1600. |
|
||||
+-------+---------------------------------------------+
|
||||
|
@ -45,10 +45,7 @@ defined:
|
||||
|
||||
The actual representation of values is determined by the machine architecture
|
||||
(strictly speaking, by the C implementation). The actual size can be accessed
|
||||
through the :attr:`itemsize` attribute. The values stored for ``'L'`` and
|
||||
``'I'`` items will be represented as Python long integers when retrieved,
|
||||
because Python's plain integer type cannot represent the full range of C's
|
||||
unsigned (long) integers.
|
||||
through the :attr:`itemsize` attribute.
|
||||
|
||||
The module defines the following type:
|
||||
|
||||
|
@ -99,7 +99,7 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
|
||||
|
||||
.. method:: BZ2File.tell()
|
||||
|
||||
Return the current file position, an integer (may be a long integer).
|
||||
Return the current file position, an integer.
|
||||
|
||||
|
||||
.. method:: BZ2File.write(data)
|
||||
|
@ -160,14 +160,14 @@ does not occur until the progress bar is next updated, typically via a call to
|
||||
|
||||
.. attribute:: ProgressBar.curval
|
||||
|
||||
The current value (of type integer or long integer) of the progress bar. The
|
||||
The current value (of type integer) of the progress bar. The
|
||||
normal access methods coerce :attr:`curval` between ``0`` and :attr:`maxval`.
|
||||
This attribute should not be altered directly.
|
||||
|
||||
|
||||
.. attribute:: ProgressBar.maxval
|
||||
|
||||
The maximum value (of type integer or long integer) of the progress bar; the
|
||||
The maximum value (of type integer) of the progress bar; the
|
||||
progress bar (thermometer style) is full when :attr:`curval` equals
|
||||
:attr:`maxval`. If :attr:`maxval` is ``0``, the bar will be indeterminate
|
||||
(barber-pole). This attribute should not be altered directly.
|
||||
|
@ -217,7 +217,7 @@ The following exceptions are the exceptions that are actually raised.
|
||||
.. exception:: OverflowError
|
||||
|
||||
Raised when the result of an arithmetic operation is too large to be
|
||||
represented. This cannot occur for long integers (which would rather raise
|
||||
represented. This cannot occur for integers (which would rather raise
|
||||
:exc:`MemoryError` than give up). Because of the lack of standardization of
|
||||
floating point exception handling in C, most floating point operations also
|
||||
aren't checked.
|
||||
|
@ -65,7 +65,7 @@ available. They are listed here in alphabetical order.
|
||||
|
||||
.. function:: abs(x)
|
||||
|
||||
Return the absolute value of a number. The argument may be a plain or long
|
||||
Return the absolute value of a number. The argument may be an
|
||||
integer or a floating point number. If the argument is a complex number, its
|
||||
magnitude is returned.
|
||||
|
||||
@ -320,8 +320,8 @@ available. They are listed here in alphabetical order.
|
||||
|
||||
Take two (non complex) numbers as arguments and return a pair of numbers
|
||||
consisting of their quotient and remainder when using long division. With mixed
|
||||
operand types, the rules for binary arithmetic operators apply. For plain and
|
||||
long integers, the result is the same as ``(a // b, a % b)``. For floating point
|
||||
operand types, the rules for binary arithmetic operators apply. For integers,
|
||||
the result is the same as ``(a // b, a % b)``. For floating point
|
||||
numbers the result is ``(q, a % b)``, where *q* is usually ``math.floor(a / b)``
|
||||
but may be 1 less than that. In any case ``q * b + a % b`` is very close to
|
||||
*a*, if ``a % b`` is non-zero it has the same sign as *b*, and ``0 <= abs(a % b)
|
||||
@ -435,7 +435,7 @@ available. They are listed here in alphabetical order.
|
||||
|
||||
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. Otherwise, the argument may be a plain or long integer
|
||||
embedded in whitespace. 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, returns ``0.0``.
|
||||
@ -530,7 +530,7 @@ available. They are listed here in alphabetical order.
|
||||
|
||||
.. function:: id(object)
|
||||
|
||||
Return the "identity" of an object. This is an integer (or long integer) which
|
||||
Return the "identity" of an object. This is an integer which
|
||||
is guaranteed to be unique and constant for this object during its lifetime.
|
||||
Two objects with non-overlapping lifetimes may have the same :func:`id` value.
|
||||
(Implementation note: this is the address of the object.)
|
||||
@ -783,7 +783,7 @@ available. They are listed here in alphabetical order.
|
||||
form ``pow(x, y)`` is equivalent to using the power operator: ``x**y``.
|
||||
|
||||
The arguments must have numeric types. With mixed operand types, the coercion
|
||||
rules for binary arithmetic operators apply. For int and long int operands, the
|
||||
rules for binary arithmetic operators apply. For :class:`int` operands, the
|
||||
result has the same type as the operands (after coercion) unless the second
|
||||
argument is negative; in that case, all arguments are converted to float and a
|
||||
float result is delivered. For example, ``10**2`` returns ``100``, but
|
||||
|
@ -37,24 +37,13 @@ supports a substantially wider range of objects than marshal.
|
||||
|
||||
Not all Python object types are supported; in general, only objects whose value
|
||||
is independent from a particular invocation of Python can be written and read by
|
||||
this module. The following types are supported: ``None``, integers, long
|
||||
integers, floating point numbers, strings, Unicode objects, tuples, lists, sets,
|
||||
this module. The following types are supported: ``None``, integers,
|
||||
floating point numbers, strings, Unicode objects, tuples, lists, sets,
|
||||
dictionaries, and code objects, where it should be understood that tuples, lists
|
||||
and dictionaries are only supported as long as the values contained therein are
|
||||
themselves supported; and recursive lists and dictionaries should not be written
|
||||
(they will cause infinite loops).
|
||||
|
||||
.. warning::
|
||||
|
||||
On machines where C's ``long int`` type has more than 32 bits (such as the
|
||||
DEC Alpha), it is possible to create plain Python integers that are longer
|
||||
than 32 bits. If such an integer is marshaled and read back in on a machine
|
||||
where C's ``long int`` type has only 32 bits, a Python long integer object
|
||||
is returned instead. While of a different type, the numeric value is the
|
||||
same. (This behavior is new in Python 2.2. In earlier versions, all but the
|
||||
least-significant 32 bits of the value were lost, and a warning message was
|
||||
printed.)
|
||||
|
||||
There are functions that read/write files as well as functions operating on
|
||||
strings.
|
||||
|
||||
|
@ -328,7 +328,7 @@ The following types can be pickled:
|
||||
|
||||
* ``None``, ``True``, and ``False``
|
||||
|
||||
* integers, long integers, floating point numbers, complex numbers
|
||||
* integers, floating point numbers, complex numbers
|
||||
|
||||
* normal and Unicode strings
|
||||
|
||||
|
@ -65,7 +65,7 @@ which format specific object types.
|
||||
|
||||
.. attribute:: Repr.maxlong
|
||||
|
||||
Maximum number of characters in the representation for a long integer. Digits
|
||||
Maximum number of characters in the representation for an integer. Digits
|
||||
are dropped from the middle. The default is ``40``.
|
||||
|
||||
|
||||
|
@ -246,7 +246,6 @@ and imaginary parts.
|
||||
.. index::
|
||||
single: arithmetic
|
||||
builtin: int
|
||||
builtin: long
|
||||
builtin: float
|
||||
builtin: complex
|
||||
|
||||
@ -326,7 +325,7 @@ Notes:
|
||||
pair: numeric; conversions
|
||||
pair: C; language
|
||||
|
||||
Conversion from floating point to (long or plain) integer may round or truncate
|
||||
Conversion from floating point to integer may round or truncate
|
||||
as in C; see functions :func:`floor` and :func:`ceil` in the :mod:`math` module
|
||||
for well-defined conversions.
|
||||
|
||||
|
@ -81,15 +81,15 @@ Python values should be obvious given their types:
|
||||
+--------+-------------------------+--------------------+-------+
|
||||
| ``i`` | :ctype:`int` | integer | |
|
||||
+--------+-------------------------+--------------------+-------+
|
||||
| ``I`` | :ctype:`unsigned int` | long | |
|
||||
| ``I`` | :ctype:`unsigned int` | integer | |
|
||||
+--------+-------------------------+--------------------+-------+
|
||||
| ``l`` | :ctype:`long` | integer | |
|
||||
+--------+-------------------------+--------------------+-------+
|
||||
| ``L`` | :ctype:`unsigned long` | long | |
|
||||
| ``L`` | :ctype:`unsigned long` | integer | |
|
||||
+--------+-------------------------+--------------------+-------+
|
||||
| ``q`` | :ctype:`long long` | long | \(2) |
|
||||
| ``q`` | :ctype:`long long` | integer | \(2) |
|
||||
+--------+-------------------------+--------------------+-------+
|
||||
| ``Q`` | :ctype:`unsigned long | long | \(2) |
|
||||
| ``Q`` | :ctype:`unsigned long | integer | \(2) |
|
||||
| | long` | | |
|
||||
+--------+-------------------------+--------------------+-------+
|
||||
| ``f`` | :ctype:`float` | float | |
|
||||
@ -139,16 +139,7 @@ count-1, it is padded with null bytes so that exactly count bytes in all are
|
||||
used. Note that for :func:`unpack`, the ``'p'`` format character consumes count
|
||||
bytes, but that the string returned can never contain more than 255 characters.
|
||||
|
||||
For the ``'I'``, ``'L'``, ``'q'`` and ``'Q'`` format characters, the return
|
||||
value is a Python long integer.
|
||||
|
||||
For the ``'P'`` format character, the return value is a Python integer or long
|
||||
integer, depending on the size needed to hold a pointer when it has been cast to
|
||||
an integer type. A *NULL* pointer will always be returned as the Python integer
|
||||
``0``. When packing pointer-sized values, Python integer or long integer objects
|
||||
may be used. For example, the Alpha and Merced processors use 64-bit pointer
|
||||
values, meaning a Python long integer will be used to hold the pointer; other
|
||||
platforms use 32-bit pointers and will use a Python integer.
|
||||
|
||||
For the ``'t'`` format character, the return value is either :const:`True` or
|
||||
:const:`False`. When packing, the truth value of the argument object is used.
|
||||
|
@ -177,18 +177,6 @@ Numbers
|
||||
object: plain integer
|
||||
single: OverflowError (built-in exception)
|
||||
|
||||
These represent numbers in the range -2147483648 through 2147483647. (The range
|
||||
may be larger on machines with a larger natural word size, but not smaller.)
|
||||
When the result of an operation would fall outside this range, the result is
|
||||
normally returned as a long integer (in some cases, the exception
|
||||
:exc:`OverflowError` is raised instead). For the purpose of shift and mask
|
||||
operations, integers are assumed to have a binary, 2's complement notation using
|
||||
32 or more bits, and hiding no bits from the user (i.e., all 4294967296
|
||||
different bit patterns correspond to different values).
|
||||
|
||||
Long integers
|
||||
.. index:: object: long integer
|
||||
|
||||
These represent numbers in an unlimited range, subject to available (virtual)
|
||||
memory only. For the purpose of shift and mask operations, a binary
|
||||
representation is assumed, and negative numbers are represented in a variant of
|
||||
@ -210,11 +198,9 @@ Numbers
|
||||
.. index:: pair: integer; representation
|
||||
|
||||
The rules for integer representation are intended to give the most meaningful
|
||||
interpretation of shift and mask operations involving negative integers and the
|
||||
least surprises when switching between the plain and long integer domains. Any
|
||||
interpretation of shift and mask operations involving negative integers. Any
|
||||
operation except left shift, if it yields a result in the plain integer domain
|
||||
without causing overflow, will yield the same result in the long integer domain
|
||||
or when using mixed operands.
|
||||
without causing overflow, will yield the same result when using mixed operands.
|
||||
|
||||
.. % Integers
|
||||
|
||||
|
@ -567,12 +567,12 @@ styles for each component (even mixing raw strings and triple quoted strings).
|
||||
Numeric literals
|
||||
----------------
|
||||
|
||||
.. index:: number, numeric literal, integer literal, plain integer literal
|
||||
long integer literal, floating point literal, hexadecimal literal
|
||||
.. index:: number, numeric literal, integer literal
|
||||
floating point literal, hexadecimal literal
|
||||
octal literal, binary literal, decimal literal, imaginary literal, complex literal
|
||||
|
||||
There are four types of numeric literals: plain integers, long integers,
|
||||
floating point numbers, and imaginary numbers. There are no complex literals
|
||||
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).
|
||||
|
||||
Note that numeric literals do not include a sign; a phrase like ``-1`` is
|
||||
|
@ -171,13 +171,12 @@ Miscellaneous options
|
||||
|
||||
Division control. The argument must be one of the following:
|
||||
|
||||
``old``
|
||||
division of int/int and long/long return an int or long (*default*)
|
||||
``new``
|
||||
new division semantics, i.e. division of int/int and long/long returns a
|
||||
float
|
||||
new division semantics, i.e. division of int/int returns a float (*default*)
|
||||
``old``
|
||||
division of int/int returns an int
|
||||
``warn``
|
||||
old division semantics with a warning for int/int and long/long
|
||||
old division semantics with a warning for int/int
|
||||
``warnall``
|
||||
old division semantics with a warning for all uses of the division operator
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user