When should one use list slice for whole list assignment?

前端 未结 0 1732
旧巷少年郎
旧巷少年郎 2020-12-13 00:18

In python we know A[:] is a copy of list A. There seems to be two ways to update a list A in Python.

A = [1, 2] #id(A)=140040769748648
A[:] = [2, 3] #id(A)=14         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题