copying classes?

harold fellermann harold.fellermann at upf.edu
Fri Dec 31 06:18:02 EST 2004


On 30.12.2004, at 01:24, It's me wrote:

> I would not think that a generic deepcopy would work for all cases.   
> An
> object can be as simple as a number, for instance, but can also be as
> complex as the universe.  I can't imagine anybody would know how to 
> copy a
> complex object otherthen the object itself.
>
> I always think that a well designed object should have a copyme method.
> :=)

take a look at the __setstate__ and __getstate__ documentation of copy
(e.g. pickle) -- with them you can customize the copying task. Anyway,
they work only on instance but not on class objects :(

- harold -

--
Military intelligence is a contradiction in terms.
-- Groucho Marx




More information about the Python-list mailing list