Jul-31-2021, 12:24 AM
(This post was last modified: Jul-31-2021, 12:24 AM by deanhystad.)
Numbers and strings are immutable objects in Python. Since, by definition, an immutable object cannot change, it doesn't make any sense to "copy" an immutable object. The object's "value" will always be the same and any copy is just wasted memory.
Variables in Python are entries in a dictionary. They are not "memory" that can be filled with different values. The only way to change a variable is through assignment (val = 5).
What is it you are trying to do? I don't understand what you mean by this:
I think you should post your code and describe the problem you are having. The example you post is not helping me understand your real problem.
Variables in Python are entries in a dictionary. They are not "memory" that can be filled with different values. The only way to change a variable is through assignment (val = 5).
What is it you are trying to do? I don't understand what you mean by this:
Quote:I've run across an issue with trying to copy an int argument for later use in the program. I realized the int that was copied is changing the value of the original argument
I think you should post your code and describe the problem you are having. The example you post is not helping me understand your real problem.