Aahz wrote:
> In article <4986bfd7$0$9385$ba4ac...@news.orange.fr>,
> m.banaouas <banaouas.media...@wanadoo.fr> wrote:
>> Working with the ElementTree module, I looked for clone element
>> function but not found such tool:
> 
> Have you tried using copy.deepcopy()?

While being the most obvious solution, calling deepcopy() on an Element is
surprisingly slow in ElementTree.

http://codespeak.net/lxml/performance.html#deepcopy

It's actually multiple times faster to rebuild the tree manually through
the API than to let deepcopy() do it. Fredrik also has written a little
factory for mass reproduction of Element trees.

http://effbot.python-hosting.com/file/stuff/sandbox/elementlib/clone.py

Stefan
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to