summaryrefslogtreecommitdiffstats
path: root/Doc/library/stdtypes.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/stdtypes.rst')
-rw-r--r--Doc/library/stdtypes.rst42
1 files changed, 25 insertions, 17 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 1ccc457..14ad15e 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -120,25 +120,24 @@ Notes:
Comparisons
===========
-.. index:: pair: chaining; comparisons
-
-There are eight comparison operations in Python. They all have the same
-priority (which is higher than that of the Boolean operations). Comparisons can
-be chained arbitrarily; for example, ``x < y <= z`` is equivalent to ``x < y and
-y <= z``, except that *y* is evaluated only once (but in both cases *z* is not
-evaluated at all when ``x < y`` is found to be false).
-
.. index::
+ pair: chaining; comparisons
pair: operator; comparison
operator: ==
operator: <
- operator: >
operator: <=
+ operator: >
operator: >=
operator: !=
operator: is
operator: is not
+There are eight comparison operations in Python. They all have the same
+priority (which is higher than that of the Boolean operations). Comparisons can
+be chained arbitrarily; for example, ``x < y <= z`` is equivalent to ``x < y and
+y <= z``, except that *y* is evaluated only once (but in both cases *z* is not
+evaluated at all when ``x < y`` is found to be false).
+
This table summarizes the comparison operations:
+------------+-------------------------+
@@ -248,6 +247,13 @@ and imaginary parts.
builtin: int
builtin: float
builtin: complex
+ operator: +
+ operator: -
+ operator: *
+ operator: /
+ operator: //
+ operator: %
+ operator: **
Python fully supports mixed arithmetic: when a binary arithmetic operator has
operands of different numeric types, the operand with the "narrower" type is
@@ -368,7 +374,15 @@ modules.
Bit-string Operations on Integer Types
--------------------------------------
-.. _bit-string-operations:
+.. index::
+ triple: operations on; integer; types
+ pair: bit-string; operations
+ pair: shifting; operations
+ pair: masking; operations
+ operator: ^
+ operator: &
+ operator: <<
+ operator: >>
Integers support additional operations that make sense only for bit-strings.
Negative numbers are treated as their 2's complement value (this assumes a
@@ -400,12 +414,6 @@ This table lists the bit-string operations sorted in ascending priority
| ``~x`` | the bits of *x* inverted | |
+------------+--------------------------------+----------+
-.. index::
- triple: operations on; integer; types
- pair: bit-string; operations
- pair: shifting; operations
- pair: masking; operations
-
Notes:
(1)
@@ -1595,7 +1603,7 @@ set``. Being an unordered collection, sets do not record element position or
order of insertion. Accordingly, sets do not support indexing, slicing, or
other sequence-like behavior.
-There are currently two builtin set types, :class:`set` and :class:`frozenset`.
+There are currently two built-in set types, :class:`set` and :class:`frozenset`.
The :class:`set` type is mutable --- the contents can be changed using methods
like :meth:`add` and :meth:`remove`. Since it is mutable, it has no hash value
and cannot be used as either a dictionary key or as an element of another set.