From: Gary P. <pa...@in...> - 2003-09-22 12:55:54
|
I got around this the following way. I don't know if it always works: pos = shape.pos + vector(0,0,0) actually, up top I define zed=vector(0,0,0) and I add zed whenever there's danger of reference problems. -g ----- Original Message ----- From: "Richard Chapman" <ax...@ch...> To: "vpython" <vis...@li...> Sent: Sunday, September 21, 2003 4:29 PM Subject: [Visualpython-users] pass by value? > hi > > how do you make sure a variable a vector in this case: is passed by value as > opposed to passed by reference. > > i have a class and in the class i have a list of positions, now i have a > function called addposition which takes in a item called pos. in the > function call i set pos=shape.pos, but when i move my shape.pos to something > else eg shape.pos + vector(1,1,1) it changes all the positions i entered > into the list to this value. > > how do i stop this happening > > thanks > > richard |