Python 中的可变对象和不可变对象

版权声明:本文为博主原创文章,欢迎大家交流 https://blog.csdn.net/he_min/article/details/79364059

python在heap分配的对象可以分为两类
· 可变对象
· 不可变对象
其中可变对象指的是对象的内容可以改变,相反,不可变对象指的是其内容不可改变。
其中可变对象有:list , dictionary
不可变对象有:int , string , float , tuple

关键点在于理解对象的引用和对象特征。可参考如下博客文章

猜你喜欢

转载自blog.csdn.net/he_min/article/details/79364059