Fredrik Lundh wrote:
time to add a __clone__ slot?
or could someone who knows what he's doing here address this comment in copy.py:
# XXX need to support copy_reg here too...
All you have to do is implement the copy protocol (ie. .copy()) for the type/class in question.
cannot find any support for that in the copy module (not in 2.0, at least)
but another reading revealed support for __copy__ and __deepcopy__ methods in at least 1.5.2 and later. intriguing...
You're right... the two methods are named __copy__ and __deepcopy__. Both should return either copies of the object or simply new reference in case the object's are immutable.
I've implemented these in mxDateTime and that was all it took to get the copy module happy (at least in Python 1.5.2).