Method returning new instance of class?
"Martin v. Löwis"
martin at v.loewis.de
Sat Sep 4 07:35:29 EDT 2004
Arthur wrote:
> Essentially I am trying to create a non-destructive tranformation of an
> instance of a class - is one way of putting it.
>
> The way I am currently conceptualizing a solution, what I need is a method
> of the class that returns a new instance of the class.
So you want a copy of the object. I'd use copy.copy for this, perhaps
copy.deepcopy.
Regards,
Martin
More information about the Python-list
mailing list