[issue16044] xml.etree.ElementTree.Element: append method iterator param is broken

Eli Bendersky report at bugs.python.org
Sun Oct 14 15:09:02 CEST 2012


Eli Bendersky added the comment:

Closing, since this isn't a bug and append's behavior is properly documented.

Regarding the error message, yes it could probably be better but you would need to enable input validation for that. Since Python is duck typed, often when arguments are not validated you get less-than-good error messages if things go wrong. In this case, append expect something Element-like that would have an "iter" method, and complains when that's not found.

In 3.3 this whole thing was improved by always validating arguments in append/extend etc. and raising a TypeError when something is wrong. I don't think there's good enough reason to change this in 2.7

----------
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16044>
_______________________________________


More information about the Python-bugs-list mailing list