Skip to content

Commit

Permalink
Merge pull request numpy#20076 from BvB93/comparison-docs
Browse files Browse the repository at this point in the history
DOC: Document the dtype comparison operations
charris authored Oct 9, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 83d8df9 + 3e2e04f commit a0d0805
Showing 2 changed files with 72 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/source/reference/arrays.dtypes.rst
Original file line number Diff line number Diff line change
@@ -569,3 +569,13 @@ Utility method for typing:
:toctree: generated/

dtype.__class_getitem__

Comparison operations:

.. autosummary::
:toctree: generated/

dtype.__ge__
dtype.__gt__
dtype.__le__
dtype.__lt__
62 changes: 62 additions & 0 deletions numpy/core/_add_newdocs.py
Original file line number Diff line number Diff line change
@@ -6113,6 +6113,68 @@
"""))

add_newdoc('numpy.core.multiarray', 'dtype', ('__ge__',
"""
__ge__(value, /)
Return ``self >= value``.
Equivalent to ``np.can_cast(value, self, casting="safe")``.
See Also
--------
can_cast : Returns True if cast between data types can occur according to
the casting rule.
"""))

add_newdoc('numpy.core.multiarray', 'dtype', ('__le__',
"""
__le__(value, /)
Return ``self <= value``.
Equivalent to ``np.can_cast(self, value, casting="safe")``.
See Also
--------
can_cast : Returns True if cast between data types can occur according to
the casting rule.
"""))

add_newdoc('numpy.core.multiarray', 'dtype', ('__gt__',
"""
__ge__(value, /)
Return ``self > value``.
Equivalent to
``self != value and np.can_cast(value, self, casting="safe")``.
See Also
--------
can_cast : Returns True if cast between data types can occur according to
the casting rule.
"""))

add_newdoc('numpy.core.multiarray', 'dtype', ('__lt__',
"""
__lt__(value, /)
Return ``self < value``.
Equivalent to
``self != value and np.can_cast(self, value, casting="safe")``.
See Also
--------
can_cast : Returns True if cast between data types can occur according to
the casting rule.
"""))

##############################################################################
#
# Datetime-related Methods

0 comments on commit a0d0805

Please sign in to comment.