[issue21403] cElementTree's Element creation handles attrib argument different from ET

2019-04-27 Thread Stefan Behnel
Stefan Behnel added the comment: Let's not change this in Py2 anymore. -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___ __

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-05-01 Thread Eli Bendersky
Eli Bendersky added the comment: > Note that this has been fixed in Py3 already (Py3.3, I guess). The only > question is whether the behaviour will be changed in Py2.7. > I don't think this issue is acute enough to warrant fixes in 2.7; however, a documentation patch would be welcome. -

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-05-01 Thread Stefan Behnel
Stefan Behnel added the comment: Note that this has been fixed in Py3 already (Py3.3, I guess). The only question is whether the behaviour will be changed in Py2.7. -- components: -XML ___ Python tracker

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-05-01 Thread Santoso Wijaya
Santoso Wijaya added the comment: Quoting dabrahams in issue 1572710: On second thought, I see what effbot is trying to say... but it's still a bug. Given the way the interface is declared and the behavior of regular python functions: Element(tag, attrib={}, **extra) indicates that I can p

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-05-01 Thread Santoso Wijaya
Santoso Wijaya added the comment: There is still a matter of inconsistency between the two implementations and between 2.7 and 3.x. IMO, the Python-based ElementTree implementation is more graceful at handling the "attrib" argument. The signature of the factory function Element (and SubElement

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-04-30 Thread Stefan Behnel
Stefan Behnel added the comment: According to issue 1572710, this is not a bug. The "attrib" argument is supposed to be a positional argument, not a keyword argument. This makes sense, given that arbitrary keyword arguments are accepted for additional XML attributes. -- _

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-04-30 Thread Stefan Behnel
Stefan Behnel added the comment: Ah, sorry, actually, it does not work in Py3.2: >>> import xml.etree.cElementTree as cET >>> root = cET.Element('root', attrib={'Name':'Root'}) >>> child = cET.SubElement(root, 'child', attrib={'Name':'Child'}) >>> cET.tostring(root) b'' That's even worse than i

[issue21403] cElementTree's Element creation handles attrib argument different from ET

2014-04-30 Thread Stefan Behnel
Stefan Behnel added the comment: Works for me in 3.2 and 3.4, fails in 2.7, as reported. I'll leave it to Eli to decide if this should get fixed in 2.7. In Py2, ET and cET were different modules, so this could also be considered a missing feature in cET. Given that it leads to a serialisation