Aahz wrote: > In article <[email protected]>, > m.banaouas <[email protected]> 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
