[Python] Understand Mutable vs. Immutable objects in Python
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Python] Understand Mutable vs. Immutable objects in Python相关的知识,希望对你有一定的参考价值。
In this lesson, you will learn what mutable and immutable objects are, and the difference between them. This understanding will help you determine when objects can be modified in place, and when new objects must be created.
List is mutable, which means everytime it returns the same id whether or not you have changed it:
foo = [] id(foo) // same foo.append(3) id(foo) // same
Immtuable such as string:
str = "Hello" id(str) // not the same str = "World" id(str) // not the same
以上是关于[Python] Understand Mutable vs. Immutable objects in Python的主要内容,如果未能解决你的问题,请参考以下文章
Understand images & containers
Utility3:Understand Dashboard Report
I don’t understand what you mean. 还是 I don’t understand what your means. 哪个对啊