Hi,

I'm using iPython and I've run into an occasional problem that I don't 
understand.  Here is what I'm seeing:

>>aa=range(0,10)
>>bb=aa
>>print aa
[0,1,2,3,4,5,6,7,8,9]
>>print bb
[0,1,2,3,4,5,6,7,8,9]
>> # okay, everything allright at this point
>>bb[5]=0  #change bb
>>print aa
[0,1,2,3,4,0,6,7,8,9]  #aa has changed!!!
>>print bb
[0,1,2,3,4,0,6,7,8,9]

So the problem is that when I change bb, aa also changes even though I don't 
want it to.  Is this supposed to happen?  If it is can someone explain to me 
why this is a good thing?  and finally, can someone give me some advice on how 
to avoid or work-around this problem.

Thanks,
Keith




      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to