[lxml-dev] problem with lxml and copy.deepcopy
Chris Abraham
cabraham at openplans.org
Tue Oct 17 16:38:59 CEST 2006
Hi,
I'm having a problem with performing a copy.deepcopy on a list of
elements. I'm finding the etree._Comment elements get turned into
None. Please see my test case:
>>> a = etree.HTML('<html><body><p>hi</p> <!-- nice comment -->
</body></html>')
>>> b = a.xpath('//body/child::node()')
>>> b
[<Element p at 2b69f7d10d20>, ' ', <!-- nice comment -->, ' ']
>>> import copy
>>> c = copy.deepcopy(b)
>>> c
[<Element p at 2b69f7d1f7d0>, ' ', None, ' ']
BTW, I'm using the CVS HEAD version of libxml2.
Any ideas? Thanks,
Chris
More information about the lxml-dev
mailing list