[Twisted-Python] copy domish element

Terry Jones terry at jon.es
Mon Jun 8 12:59:21 EDT 2009

Hi Jack

>>>>> "Jack" == Jack Bates <jack.bates at gmail.com> writes:

Jack> i have a domish element - when i try the following,
>>>> message = element
>>>> del message['from']
>>>> element['from']

Jack> - i get a key error

Jack> to avoid this key error, i think i want to copy the element, so i can
Jack> drop the 'from' attribute from one copy without affecting the other?

Jack> but i didn't find anything to make a copy in the domish element api
Jack> how should i avoid this key error?

If I'm interpreting you right, you might try

    from copy import deepcopy
    message = deepcopy(element)
    # etc.

Not sure what this has to do with Twisted :-)


More information about the Twisted-Python mailing list