summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorZhikang Yan <2951256653@qq.com>2024-10-27 04:57:43 (GMT)
committerGitHub <noreply@github.com>2024-10-27 04:57:43 (GMT)
commitdad34531298fc0ea91b9000aafdd2ea2fce5e54a (patch)
tree8250e27c253d190a4a6a1e8a1e1b36f9c77d7d3e /Doc
parentc51b56038ba344dece607eb5f035dca544187813 (diff)
downloadcpython-dad34531298fc0ea91b9000aafdd2ea2fce5e54a.zip
cpython-dad34531298fc0ea91b9000aafdd2ea2fce5e54a.tar.gz
cpython-dad34531298fc0ea91b9000aafdd2ea2fce5e54a.tar.bz2
gh-125633: Add function `ispackage` to stdlib `inspect` (#125634)
--------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/inspect.rst7
-rw-r--r--Doc/whatsnew/3.14.rst4
2 files changed, 11 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 1eaf1cc..892f5ba 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -374,6 +374,13 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
Return ``True`` if the object is a bound method written in Python.
+.. function:: ispackage(object)
+
+ Return ``True`` if the object is a :term:`package`.
+
+ .. versionadded:: 3.14
+
+
.. function:: isfunction(object)
Return ``True`` if the object is a Python function, which includes functions
diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst
index d95f184..1ccfa32 100644
--- a/Doc/whatsnew/3.14.rst
+++ b/Doc/whatsnew/3.14.rst
@@ -326,6 +326,10 @@ inspect
If true, string :term:`annotations <annotation>` are displayed without surrounding quotes.
(Contributed by Jelle Zijlstra in :gh:`101552`.)
+* Add function :func:`inspect.ispackage` to determine whether an object is a
+ :term:`package` or not.
+ (Contributed by Zhikang Yan in :gh:`125634`.)
+
json
----