summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorNico Mexis <nico.mexis@kabelmail.de>2024-08-10 19:16:34 (GMT)
committerGitHub <noreply@github.com>2024-08-10 19:16:34 (GMT)
commit5580f31c56e6f90909bdceddda077504cc2d18b0 (patch)
tree5ca58367cfef11b9bed9430db22378071f6a9029 /Doc/library
parent0fd97e46c75bb3060485b796ca597b13af7e6bec (diff)
downloadcpython-5580f31c56e6f90909bdceddda077504cc2d18b0.zip
cpython-5580f31c56e6f90909bdceddda077504cc2d18b0.tar.gz
cpython-5580f31c56e6f90909bdceddda077504cc2d18b0.tar.bz2
gh-115808: Add ``is_none`` and ``is_not_none`` to ``operator`` (#115814)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/operator.rst18
1 files changed, 18 insertions, 0 deletions
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
index a9a6026..e8e7106 100644
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -80,6 +80,20 @@ truth tests, identity tests, and boolean operations:
Return ``a is not b``. Tests object identity.
+.. function:: is_none(a)
+
+ Return ``a is None``. Tests object identity.
+
+ .. versionadded:: 3.14
+
+
+.. function:: is_not_none(a)
+
+ Return ``a is not None``. Tests object identity.
+
+ .. versionadded:: 3.14
+
+
The mathematical and bitwise operations are the most numerous:
@@ -405,6 +419,10 @@ Python syntax and the functions in the :mod:`operator` module.
+-----------------------+-------------------------+---------------------------------------+
| Identity | ``a is not b`` | ``is_not(a, b)`` |
+-----------------------+-------------------------+---------------------------------------+
+| Identity | ``a is None`` | ``is_none(a)`` |
++-----------------------+-------------------------+---------------------------------------+
+| Identity | ``a is not None`` | ``is_not_none(a)`` |
++-----------------------+-------------------------+---------------------------------------+
| Indexed Assignment | ``obj[k] = v`` | ``setitem(obj, k, v)`` |
+-----------------------+-------------------------+---------------------------------------+
| Indexed Deletion | ``del obj[k]`` | ``delitem(obj, k)`` |