Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1aeba745
Commit
1aeba745
authored
Sep 14, 2018
by
Windson yang
Committed by
Miss Islington (bot)
Sep 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34552: Clarify built-in types comparisons (GH-9035)
Some updates to ancient text about comparisons; fixes bp-34552.
parent
1401018d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
Doc/library/stdtypes.rst
Doc/library/stdtypes.rst
+8
-10
Misc/NEWS.d/next/Documentation/2018-09-12-10-18-04.bpo-34552.p9PoYv.rst
...xt/Documentation/2018-09-12-10-18-04.bpo-34552.p9PoYv.rst
+2
-0
No files found.
Doc/library/stdtypes.rst
View file @
1aeba745
...
...
@@ -20,10 +20,10 @@ rearrange their members in place, and don't return a specific item, never return
the collection instance itself but ``None``.
Some operations are supported by several object types; in particular,
practically all objects can be compared
, tested for truth value, and converted
to a string (with the :func:`repr` function or the slightly different
:func:`str` function). The latter function is implicitly used when an object is
written by the :func:`print` function.
practically all objects can be compared
for equality, tested for truth
value, and converted to a string (with the :func:`repr` function or the
slightly different :func:`str` function). The latter function is implicitly
used when an object is
written by the :func:`print` function.
.. _truth:
...
...
@@ -164,12 +164,10 @@ This table summarizes the comparison operations:
pair: objects; comparing
Objects of different types, except different numeric types, never compare equal.
Furthermore, some types (for example, function objects) support only a degenerate
notion of comparison where any two objects of that type are unequal. The ``<``,
``<=``, ``>`` and ``>=`` operators will raise a :exc:`TypeError` exception when
comparing a complex number with another built-in numeric type, when the objects
are of different types that cannot be compared, or in other cases where there is
no defined ordering.
The ``==`` operator is always defined but for some object types (for example,
class objects) is equivalent to :keyword:`is`. The ``<``, ``<=``, ``>`` and ``>=``
operators are only defined where they make sense; for example, they raise a
:exc:`TypeError` exception when one of the arguments is a complex number.
.. index::
single: __eq__() (instance method)
...
...
Misc/NEWS.d/next/Documentation/2018-09-12-10-18-04.bpo-34552.p9PoYv.rst
0 → 100644
View file @
1aeba745
Make clear that ``==`` operator sometimes is equivalent to `is`. The ``<``,
``<=``, ``>`` and ``>=`` operators are only defined where they make sense.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment