What happens when you assign the value of one variable to another variable in Python?

后端 未结 10 826
太阳男子
太阳男子 2020-11-30 00:54

This is my second day of learning python (I know the basics of C++ and some OOP.), and I have some slight confusion regarding variables in python.

Here is how I unde

10条回答
  •  生来不讨喜
    2020-11-30 01:44

    When you run spam = 100 python create one more object in the memory but not change existing. so you still have pointer cheese to 42 and spam to 100

提交回复
热议问题