+ 1

mutable and immutable datatypes in python

In python int is immutable so x=1 x=4 Here we are able to alter x as x is only referencing to the integer object in memory and there are thus two objects (1,4) present in the memory. Similarly.if a tuple is also immutable then why x= (1,4) x[0]=2 will generate an error. Like int datatype tuple should also allow to produce new object keeping the old object still in the memory.

11th May 2019, 2:13 PM
harshit
harshit - avatar
1 Answer
0
Anna ~ swim ~ Thoq! please see this
11th May 2019, 2:14 PM
harshit
harshit - avatar