[Python-Dev] Re: [ python-Bugs-416670 ] MatchObjects not deepcopy()able

Tim Peters tim.one@home.com
Thu, 26 Apr 2001 19:52:55 -0400


[/F]
> thought I'd check this one with python-dev before marking
> it as "won't fix".  I cannot see any reason why anyone would
> even attempt to deepcopy match objects...

Likely just because they're part of other objects, like bound to instance
attributes, or members of lists.  No matter how deep they're buried, someone
trying to deepcopy a container will eventually need to deepcopy them too.

> (cannot see any reason why anyone would use deepcopy for
> anything, but that's another story)

It's a std way to get a clone of an object, and when you don't want mutations
of the clone to have any effect on the original (or vice versa).  Perhaps if
I call it the Clone Pattern, people will assume that makes it a good thing
and cut that part of the debate mercifully short <wink>.

It's *nice* to supply a deepcopy operation whenever it's doable with
reasonable effort.  I agree you're not required to in this case -- but it
would still be "nice", if that's feasible.