Skip to content

gh-136231: Document xml.etree.ElementTree.iselement behavior when used with types #136484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Doc/library/xml.etree.elementtree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:`isinstance`.


.. function:: iterparse(source, events=None, parser=None)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document that :func:`xml.etree.ElementTree.iselement` works identically on
both object instances and types.
Loading