Python Forum
Non-mutability of integer-valued variables.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Non-mutability of integer-valued variables.
#2
cheese += 1 is short for cheese = cheese + 1, it is not increasing the cheese int value of 42 by 1
cheese is pointing at a int of 42, + int of 1 gives a result of an int of 43 which cheese now points to.
spam is left pointing to the original int 42
Reply


Messages In This Thread
RE: Non-mutability of integer-valued variables. - by Yoriz - Jul-19-2020, 04:16 PM

Forum Jump:

User Panel Messages

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