简体   繁体   中英

Mutable types in python

Of the basic types of python, which of those are mutable? From reviewing the docs it looks like:

  • list
  • set (though not frozenset )
  • dict

Are the only mutable types, and everything else is immutable, but I wasn't able to find a definitive list on this. Is the above correct, or am I missing any python types that are mutable?

Take a look to this page in documentation . Here you can find all information about mutability of most common types in Python.

PS It is rather comment than answer, but my reputation is too small to comment.

  1. Some of the mutable data types in Python are list, dictionary, set and user-defined classes.

  2. On the other hand, some of the immutable data types are int, float, decimal, bool, string, tuple, and range.

https://towardsdatascience.com/https-towardsdatascience-com-python-basics-mutable-vs-immutable-objects-829a0cb1530a[Source][1]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM