Kent Johnson schrieb:
> 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):
>> r
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 clas
Kent Johnson schrieb:
> Gregor Lingl wrote:
>
>>Hi all of you,
...
>>> from copy import deepcopy
>> >>> class Vec(tuple):
>> def __new__(cls, x, y):
>> return tuple.__new__(cls, (x,y))
>> def __abs__(self):
>> return (self[0]**2+self[1]**2)**0.5
>> ##
Gregor Lingl wrote:
> Hi all of you,
>
> I've some Vector class, which is a subclass of tuple and which is
> working satisfactorily since long in different contexts. Now I've
> constructed objects with attributes of Vec-type, which I wanted to
> deepcopy. But that doesn't work, because I can't
Hi all of you,
I've some Vector class, which is a subclass of tuple and which is
working satisfactorily since long in different contexts. Now I've
constructed objects with attributes of Vec-type, which I wanted to
deepcopy. But that doesn't work, because I can't (deep)copy Vec-s:
>>> from cop