unnecessary change

Steve Holden sholden at holdenweb.com
Tue Oct 23 06:49:58 EDT 2001


"Giorgi Lekishvili" <gleki at gol.ge> wrote in message
news:3BD5BCDF.B40C1422 at gol.ge...
> Hi folks!
>
> My problem is the following:
> I want to save initial data matrix, as e.g., follows
>     self.Mdata=Matr
> In the same time I need a matrix, which is used and processed. The
> latter is created as follows
>     self.Mactual=self.Mdata
>
> No the problem is, that, when I have finished to use the Mactual matrix,
> self.Mdata is always changed and equals the final Mactual matrix.
>
> What is the systematic solution of the problem?
>
> Thanx in advance,
> Giorgi
>
> PS. I use Numeric module.
>
This is because Python variable bindings are actually references. You
probably need to make a copy of the matric. See if the copy module (and
particularly copy.deepcopy()) will help.

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list