summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-03-23 12:24:20 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-03-23 12:24:20 (GMT)
commit396e8fcf36480dacaeeeb785a3912a565294d3b7 (patch)
tree173647551cef119cdf7644b8eb009b4a48314995 /Doc/library
parent42243c4dcaee5fe6e680d1ea4b1b615dd0d18b10 (diff)
downloadcpython-396e8fcf36480dacaeeeb785a3912a565294d3b7.zip
cpython-396e8fcf36480dacaeeeb785a3912a565294d3b7.tar.gz
cpython-396e8fcf36480dacaeeeb785a3912a565294d3b7.tar.bz2
Issue #13782: streamline argument type-checking in ET.Element
append, extend and insert now consistently type-check their argument in both the C and Python implementations, and raise TypeError for non-Element argument. Added tests
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/xml.etree.elementtree.rst12
1 files changed, 7 insertions, 5 deletions
diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst
index 6fe81c9..dc13c49 100644
--- a/Doc/library/xml.etree.elementtree.rst
+++ b/Doc/library/xml.etree.elementtree.rst
@@ -281,14 +281,15 @@ Element Objects
.. method:: append(subelement)
- Adds the element *subelement* to the end of this elements internal list
- of subelements.
+ Adds the element *subelement* to the end of this element's internal list
+ of subelements. Raises :exc:`TypeError` if *subelement* is not an
+ :class:`Element`.
.. method:: extend(subelements)
Appends *subelements* from a sequence object with zero or more elements.
- Raises :exc:`AssertionError` if a subelement is not a valid object.
+ Raises :exc:`TypeError` if a subelement is not an :class:`Element`.
.. versionadded:: 3.2
@@ -325,9 +326,10 @@ Element Objects
Use method :meth:`Element.iter` instead.
- .. method:: insert(index, element)
+ .. method:: insert(index, subelement)
- Inserts a subelement at the given position in this element.
+ Inserts *subelement* at the given position in this element. Raises
+ :exc:`TypeError` if *subelement* is not an :class:`Element`.
.. method:: iter(tag=None)