[MATRIX-SIG] Suggestion: alias __deepcopy__ as __copy__ for arrays ??

Bruce Duncan bsd@scripps.edu
Sat, 21 Feb 1998 13:34:48 -0800 (PST)


Greetings,

The standard module copy will not do a deepcopy of class instances
if they contain Numeric arrays.  This seems to be because the
array type does not define a __deepcopy__ function.
(Numeric does define a __copy__ function.)
However, it seems that for most cases of Numeric arrays
(float, int, byte, etc.) a __deepcopy__ is equivalent to a __copy__.
[How could a deepcopy be different than a copy for an array??]
IF, (repeat IF), this is true, then it seems that a
__deepcopy__ method can be defined as an alias to the __copy__ method.
That way, a deepcopy of objects containing arrays should work.

Comments?

-bsd-

Bruce Duncan
The Scripps Research Institute 
bsd@scripps.edu

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________