Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
2fc2cba0
Commit
2fc2cba0
authored
Nov 25, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark special "__richcmp__()" method as deprecated in the docs.
Closes #1848.
parent
c54ffc3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
docs/src/reference/extension_types.rst
docs/src/reference/extension_types.rst
+3
-2
docs/src/userguide/special_methods.rst
docs/src/userguide/special_methods.rst
+6
-2
No files found.
docs/src/reference/extension_types.rst
View file @
2fc2cba0
...
...
@@ -279,9 +279,10 @@ Rich Comparisons
* Starting with Cython 0.27, the Python
`special methods <https://docs.python.org/3/reference/datamodel.html#basic-customization>`_
``__eq__``, ``__lt__``, etc. can be implemented. In previous versions, ``__richcmp__`` was
the only way to implement rich comparisons.
the only way to implement rich comparisons
, but is now deprecated
.
* A single special method called ``__richcmp__()`` can be used to implement all the individual
rich compare, special method types.
rich compare, special method types. Note, however, that it is often easier to correctly
implement the separate Python special methods than to get the ``__richcmp__()`` method right.
* ``__richcmp__()`` takes an integer argument, indicating which operation is to be performed
as shown in the table below.
...
...
docs/src/userguide/special_methods.rst
View file @
2fc2cba0
...
...
@@ -209,8 +209,6 @@ Rich comparison operators
https://docs.python.org/3/reference/datamodel.html#basic-customization
+-----------------------+---------------------------------------+-------------+--------------------------------------------------------+
| __richcmp__ |x, y, int op | object | Rich comparison (no direct Python equivalent) |
+-----------------------+---------------------------------------+-------------+--------------------------------------------------------+
| __eq__ |self, y | object | self == y |
+-----------------------+---------------------------------------+-------------+--------------------------------------------------------+
...
...
@@ -224,6 +222,12 @@ https://docs.python.org/3/reference/datamodel.html#basic-customization
+-----------------------+---------------------------------------+-------------+--------------------------------------------------------+
| __ge__ |self, y | object | self >= y |
+-----------------------+---------------------------------------+-------------+--------------------------------------------------------+
| __richcmp__ |x, y, int op | object | Joined rich comparison method for all of the above |
| | | | (deprecated, no direct Python equivalent) |
+-----------------------+---------------------------------------+-------------+--------------------------------------------------------+
New code should better implement the separate Python special methods instead of trying to
correctly implement the joined ``__richcmp__()`` method.
Arithmetic operators
^^^^^^^^^^^^^^^^^^^^
...
...
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