Common immutable type:
int()
, float()
, complex()
str()
, tuple()
, frozenset()
, bytes()
Common mutable type (almost everything else):
list()
, bytearray()
set()
dict()
One trick to quickly test if a type is mutable or not, is to use id()
built-in function.
Examples, using on integer,
>>> i = 1
>>> id(i)
***704
>>> i += 1
>>> i
2
>>> id(i)
***736 (different from ***704)
using on list,
>>> a = [1]
>>> id(a)
***416
>>> a.append(2)
>>> a
[1, 2]
>>> id(a)
***416 (same with the above id)