'Mutable types in python
Of the basic types of python, which of those are mutable? From reviewing the docs it looks like:
listset(though notfrozenset)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?
Solution 1:[1]
Some of the mutable data types in Python are list, dictionary, set and user-defined classes.
On the other hand, some of the immutable data types are int, float, decimal, bool, string, tuple, and range.
Solution 2:[2]
Take a look to this page in documentation. Here you can find all information about mutability of most common types in Python.
P. S. It is rather comment than answer, but my reputation is too small to comment.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | eyllanesc |
| Solution 2 |
