To become an effective Python programmer, it is crucial that you learn to draw the distinction between altering an object and assigning to a name, which previously happened to refer to the object. These two kinds of operations have nothing to do with each other. A statement such as a = [] rebinds name a but performs no alteration at all on the object that was previously bound to name a. Therefore, the issue of references versus copies just doesn't arise in this case: the issue is meaningful only when you alter some object.
[Python]alter or assign an object
最新推荐文章于 2024-01-14 17:58:06 发布
本文探讨了Python编程中理解对象修改与名称赋值的区别。文章强调了区分这两种操作的重要性,并解释了为何在某些情况下讨论对象的引用与拷贝是没有意义的。
1693

被折叠的 条评论
为什么被折叠?



