Comment 6 for bug 2065120

Revision history for this message
Leonard Richardson (leonardr) wrote (last edit ):

Yes, copy and deepcopy both create deep copies. There are no shallow copies in Beautiful Soup because a given PageElement can only be in one tree at a time; otherwise we'd get behavior so subtle as to be indistinguishable from a bug.

Maybe 'twin' would work as a method name here. It doesn't imply a detailed recreation of the entire data structure, the way 'clone' does, because it ties into the metaphor of the DOM as a family tree, and we don't expect twins to have the same children.