From 8a7b2d2a76e178ba1654d528a6a11953dc9089cf Mon Sep 17 00:00:00 2001 From: Kira K Date: Wed, 9 Jul 2025 15:06:46 -0400 Subject: [PATCH 1/3] News entry --- .../2025-07-09-15-06-27.gh-issue-136231.Wx8W-w.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Documentation/2025-07-09-15-06-27.gh-issue-136231.Wx8W-w.rst diff --git a/Misc/NEWS.d/next/Documentation/2025-07-09-15-06-27.gh-issue-136231.Wx8W-w.rst b/Misc/NEWS.d/next/Documentation/2025-07-09-15-06-27.gh-issue-136231.Wx8W-w.rst new file mode 100644 index 00000000000000..d5082eaf48158f --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2025-07-09-15-06-27.gh-issue-136231.Wx8W-w.rst @@ -0,0 +1,2 @@ +Document that :func:`xml.etree.ElementTree.iselement` works identically on +both object instances and types. From 90d09deb4c19cd3584b63ad115aba1ce86a88b47 Mon Sep 17 00:00:00 2001 From: Kira K Date: Wed, 9 Jul 2025 14:57:55 -0400 Subject: [PATCH 2/3] Document iselement behavior when used with types --- Doc/library/xml.etree.elementtree.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index 00075ac2a23e6b..9b8032191cd60d 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -610,8 +610,11 @@ Functions .. function:: iselement(element) - Check if an object appears to be a valid element object. *element* is an - element instance. Return ``True`` if this is an element object. + Check if *element* appears to be a valid element object or type. Return + ``True`` if this is an element object or type. + + Because ``iselement`` behaves identically for both objects and types, code + requiring an object should check for this, see :func:`iselement`. .. function:: iterparse(source, events=None, parser=None) From aa109110310ff1a7f5eec18957450b6a003fc05c Mon Sep 17 00:00:00 2001 From: Kira K Date: Wed, 9 Jul 2025 16:01:24 -0400 Subject: [PATCH 3/3] Fixed incorrect function mention --- Doc/library/xml.etree.elementtree.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index 9b8032191cd60d..b842c5aff76e3d 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -614,7 +614,7 @@ Functions ``True`` if this is an element object or type. Because ``iselement`` behaves identically for both objects and types, code - requiring an object should check for this, see :func:`iselement`. + requiring an object should check for this, see :func:`isinstance`. .. function:: iterparse(source, events=None, parser=None)