[issue6230] ElementTree.Element and cElementTree.Element have slightly different repr

Neil Muller report at bugs.python.org
Sun Jun 7 16:08:16 CEST 2009


New submission from Neil Muller <drnlmuller+bugs at gmail.com>:

ElementTree and cElementTree give slightly different results for
repr(Element):

>>> import xml.etree.ElementTree as ET
>>> import xml.etree.cElementTree as cET
>>> repr(ET.ElementTree('tag'))
'<Element tag at b7cf506c>'
>>> repr(cET.ElementTree('tag')
"<Element 'tag' at 0xb7c266f8>"

The quoting around the tag name is missing from ElementTree.

This inconsistency seems pointless.

Attached patch changes ElementTree to match cElementTree behaviour, and
adds a test.

----------
components: Library (Lib)
files: repr-fix.diff
keywords: patch
messages: 89035
nosy: Neil Muller, effbot
severity: normal
status: open
title: ElementTree.Element and cElementTree.Element have slightly different repr
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1
Added file: http://bugs.python.org/file14212/repr-fix.diff

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


More information about the Python-bugs-list mailing list