+ 2

Mutable object

what does mutable object means? It is a integer mutable object that can not be assigned or something else?

26th May 2017, 3:55 PM
jay dave
jay dave - avatar
1 Answer
+ 12
mutable objects are objects that can be changed after creation immutable objects cannot be changed for instance, lists and dictionaries are mutable lst = [1,2,3,4,5] lst[2] = 42 # change 3 to 42 tuples are immutable objects tup = (1,2,3,4,5) tup[2] = 42 # cannot perform assignment
26th May 2017, 4:02 PM
Burey
Burey - avatar