Gregor Lingl wrote: > Thanks, Kent for the hint. It works (of course). > Skimming through this part of the docs I discovered, that there is a > special method __deepcopy__. So I also tried using this, adding > > def __deepcopy__(self,visit): > return self > > to my Vec class, which also seems to work. (I think this not to > be harmful as Vecs should be, like tuples, immutable). > And, indeed, it also seems to work.
That is not a correct deep copy, it is a shallow copy. Although Vec objects are immutable they may contain mutable objects. The point of deep copy is to copy "all the way down" so the objects contained by a Vec should also be copied. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor