Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Value by reference issue
#2
I'm not sure your code demonstrates anything changing. Can you give more information on how this behavior was causing a problem? All I see above is that you've made NewVal1, NewVal2, and NewVal3 point to the same object. That shouldn't cause issues.

ints are immutable, so there is usually no benefit to trying to make some sort of independent copy of them. An int can never change. I wonder if your original problem wasn't that the ints were the same object but something else happening.

Can you show the part where the original value changed?
Reply


Messages In This Thread
Value by reference issue - by javaben - Jul-30-2021, 10:40 PM
RE: Value by reference issue - by bowlofred - Jul-30-2021, 11:32 PM
RE: Value by reference issue - by javaben - Jul-30-2021, 11:59 PM
RE: Value by reference issue - by javaben - Jul-31-2021, 02:36 AM
RE: Value by reference issue - by bowlofred - Jul-31-2021, 12:22 AM
RE: Value by reference issue - by deanhystad - Jul-31-2021, 12:24 AM
RE: Value by reference issue - by deanhystad - Jul-31-2021, 04:47 AM
RE: Value by reference issue - by javaben - Jul-31-2021, 04:48 AM
RE: Value by reference issue - by deanhystad - Jul-31-2021, 04:59 AM
RE: Value by reference issue - by javaben - Jul-31-2021, 12:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,581 Sep-07-2020, 08:02 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020