Silvan Jegen added the comment: The situation is as follows.
According to the online documentation of Python 2.7 the xml.etree.ElementTree.iterparse() function takes up to three arguments, two of them named ones: xml.etree.ElementTree.iterparse(source, events=None, parser=None) In the C implementation of the function however, the "parser" argument does not seem to be supported: >>> import xml.etree.ElementTree as ET >>> import xml.etree.cElementTree as ETc # C version of the library >>> result = ET.iterparse("xmltest.xml", None, ET.XMLParser()) # Works >>> >>> result = ETc.iterparse("xmltest.xml", None, ET.XMLParser()) # C version does'nt Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() takes at most 3 arguments (4 given) The documentation does not mention the C version of the function not taking the "parser" argument as far as I know. Additionally, the xml.etree.ElementTree.iterparse() online documentation for Python 3.3 mentions the "parser" argument as well. When using this argument however, Python throws an error: Python 3.3.0 (default, Dec 22 2012, 21:02:07) [GCC 4.7.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import xml.etree.ElementTree as ET >>> ET.iterparse("xmltest.xml", None, ET.XMLParser()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: __init__() takes from 2 to 3 positional arguments but 4 were given A look at the pydoc output for xml.etree.ElementTree actually does not mention a named "parser" argument to iterparse() at all (Please note that iterparse seems to be a constructor in Python 3.3): class iterparse(builtins.object) | Methods defined here: | | __init__(self, file, events=None) In these cases either the implementation or the documentation should be changed. Please feel free to ask away if you have more questions. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9708> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com