From: Prometheus3375 <35541026+Prometheus3375@users.noreply.github.com> Date: Tue, 31 Oct 2023 16:16:55 +0000 (+0300) Subject: gh-93607: document `root` attribute of `iterparse` (#99410) X-Git-Tag: v3.13.0a2~255 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5cc6c80a7797c08c884edf94de4fc7b6075e32ce;p=thirdparty%2FPython%2Fcpython.git gh-93607: document `root` attribute of `iterparse` (#99410) Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com> Co-authored-by: Hugo van Kemenade --- diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index c9b32632c6b3..57cfbb8d9224 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -622,7 +622,9 @@ Functions *parser* is an optional parser instance. If not given, the standard :class:`XMLParser` parser is used. *parser* must be a subclass of :class:`XMLParser` and can only use the default :class:`TreeBuilder` as a - target. Returns an :term:`iterator` providing ``(event, elem)`` pairs. + target. Returns an :term:`iterator` providing ``(event, elem)`` pairs; + it has a ``root`` attribute that references the root element of the + resulting XML tree once *source* is fully read. Note that while :func:`iterparse` builds the tree incrementally, it issues blocking reads on *source* (or the file it names). As such, it's unsuitable