snake.velocity = Point(0,-1)
print(snake.velocity)
print(Point(0,-1))
print(snake.velocity == Point(0,-1))    #FALSE,因为Point(0,-1)每次都是一个新地址
aaa = Point(0,-1)
snake.velocity = aaa
print(snake.velocity == Point(0,-1))    #FALSE,因为Point(0,-1)每次都是一个新地址
print(snake.velocity == aaa)          #TRUE,因为aaa固定了地址,snake.velocity指向的刚好是aaa指向的地址

 

相关文章:

  • 2022-12-23
  • 2021-11-09
  • 2021-08-21
  • 2022-12-23
  • 2022-02-01
  • 2019-03-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2022-02-27
  • 2021-09-10
相关资源
相似解决方案