Are python variables pointers? or else what are they?

前端 未结 9 2057
借酒劲吻你
借酒劲吻你 2020-11-22 07:01

Variables in Python are just pointers, as far as I know.

Based on this rule, I can assume that the result for this code snippet:

i = 5
j = i
j = 3          


        
9条回答
  •  天命终不由人
    2020-11-22 07:33

    When you set j=3 the label j no longer applies (points) to i, it starts to point to the integer 3. The name i is still referring to the value you set originally, 5.

提交回复
热议问题