+ 2
Mutable & Immutabe
Difference between mutable and immutable? Why strings is immutable?
2 odpowiedzi
+ 7
Mutable means that you can take some index of an iterable "av" and do:
av[index]=newvalue
Strings can't do that so they're immutable.
Not the actual definition but a good helper I suppose?
+ 4
It's just the way Python defined it.
Basically it goes like this: Container types like lists, dictionaries or sets are mutable; because the whole point of having them is being able to add stuff, move it around and take it out.
Whenever you don't need that (like with numbers or strings) it's safer if they are immutable.