diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2017-10-13 22:39:02 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2017-10-13 22:39:02 +0200 |
commit | 4c461c93ba8539cb71ab279e4c2ca82436fb07b3 (patch) | |
tree | fbc78ca94ba2bad4e9b9486b1772afc4b22a3075 | |
parent | 244dd822c405d7bfa8478fa7ae9dc25b8d5d4751 (diff) | |
download | cython-4c461c93ba8539cb71ab279e4c2ca82436fb07b3.tar.gz |
Link to the special method documentation in CPython from the Cython docs.
-rw-r--r-- | docs/src/reference/extension_types.rst | 6 | ||||
-rw-r--r-- | docs/src/userguide/special_methods.rst | 24 |
2 files changed, 25 insertions, 5 deletions
diff --git a/docs/src/reference/extension_types.rst b/docs/src/reference/extension_types.rst index 60f2cbc97..ae6460ab9 100644 --- a/docs/src/reference/extension_types.rst +++ b/docs/src/reference/extension_types.rst @@ -276,8 +276,10 @@ Arithmetic Methods Rich Comparisons ================ -* Starting with Cython 0.27, the Python special methods ``__eq__``, ``__lt__``, etc. can be implemented. - In previous versions, ``__richcmp__`` was the only way to implement 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. * A single special method called ``__richcmp__()`` can be used to implement all the individual rich compare, special method types. * ``__richcmp__()`` takes an integer argument, indicating which operation is to be performed diff --git a/docs/src/userguide/special_methods.rst b/docs/src/userguide/special_methods.rst index 467f94f1e..84c5950c3 100644 --- a/docs/src/userguide/special_methods.rst +++ b/docs/src/userguide/special_methods.rst @@ -127,9 +127,11 @@ take `self` as the first argument. Rich comparisons ----------------- -Starting with Cython 0.27, the Python special methods :meth:``__eq__``, :meth:``__lt__``, etc. -can be implemented. In previous versions, :meth:``__richcmp__`` was the only way to implement -rich comparisons. It takes an integer indicating which operation is to be performed, as follows: +Starting with Cython 0.27, the Python +`special methods <https://docs.python.org/3/reference/datamodel.html#basic-customization>`_ +:meth:``__eq__``, :meth:``__lt__``, etc. can be implemented. In previous versions, +:meth:``__richcmp__`` was the only way to implement rich comparisons. It takes an integer +indicating which operation is to be performed, as follows: +-----+-----+-------+ | < | 0 | Py_LT | @@ -170,6 +172,8 @@ declare different types, conversions will be performed as necessary. General ^^^^^^^ +https://docs.python.org/3/reference/datamodel.html#special-method-names + +-----------------------+---------------------------------------+-------------+-----------------------------------------------------+ | Name | Parameters | Return type | Description | +=======================+=======================================+=============+=====================================================+ @@ -203,6 +207,8 @@ General 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) | +-----------------------+---------------------------------------+-------------+-----------------------------------------------------+ @@ -222,6 +228,8 @@ Rich comparison operators Arithmetic operators ^^^^^^^^^^^^^^^^^^^^ +https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types + +-----------------------+---------------------------------------+-------------+-----------------------------------------------------+ | Name | Parameters | Return type | Description | +=======================+=======================================+=============+=====================================================+ @@ -267,6 +275,8 @@ Arithmetic operators Numeric conversions ^^^^^^^^^^^^^^^^^^^ +https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types + +-----------------------+---------------------------------------+-------------+-----------------------------------------------------+ | Name | Parameters | Return type | Description | +=======================+=======================================+=============+=====================================================+ @@ -286,6 +296,8 @@ Numeric conversions In-place arithmetic operators ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types + +-----------------------+---------------------------------------+-------------+-----------------------------------------------------+ | Name | Parameters | Return type | Description | +=======================+=======================================+=============+=====================================================+ @@ -319,6 +331,8 @@ In-place arithmetic operators Sequences and mappings ^^^^^^^^^^^^^^^^^^^^^^ +https://docs.python.org/3/reference/datamodel.html#emulating-container-types + +-----------------------+---------------------------------------+-------------+-----------------------------------------------------+ | Name | Parameters | Return type | Description | +=======================+=======================================+=============+=====================================================+ @@ -342,6 +356,8 @@ Sequences and mappings Iterators ^^^^^^^^^ +https://docs.python.org/3/reference/datamodel.html#emulating-container-types + +-----------------------+---------------------------------------+-------------+-----------------------------------------------------+ | Name | Parameters | Return type | Description | +=======================+=======================================+=============+=====================================================+ @@ -377,6 +393,8 @@ Buffer interface [legacy] (no Python equivalents - see note 1) Descriptor objects (see note 2) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +https://docs.python.org/3/reference/datamodel.html#emulating-container-types + +-----------------------+---------------------------------------+-------------+-----------------------------------------------------+ | Name | Parameters | Return type | Description | +=======================+=======================================+=============+=====================================================+ |