Understanding Python's “is” operator

前端 未结 11 2427
别那么骄傲
别那么骄傲 2020-11-21 22:42

The is operator does not match the values of the variables, but the instances themselves.

What does it really mean?

11条回答
  •  萌比男神i
    2020-11-21 23:01

    X points to an array, Y points to a different array. Those arrays are identical, but the is operator will look at those pointers, which are not identical.

提交回复
热议问题