Joseph Nail <joseph2001n...@gmail.com> writes: > Hello, > I have one problem. Somehow in my function when I wrote y=x, they are the > same variable and then it also changes age or height (which were x) in the > main program. See more in attached file. > Maybe it is bug or maybe it should run that way.
If you write y = x, then they are not the same variable, but they point to (the proper Python language is they are bound to) the same object. Now if you say x.age = 20, then y.age will also be 20 (it's the same object). -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list