2021年1月19日星期二

Why an integer object is considered immutable in Python?

Excuse me for my ignorance. I know it sounds too basic, but I am confused about it. I create a variable

x = 45  

in python and later on, I reassign x = 35

Here I have changed x which was an int type. It mutated. But why it is considered an immutable object type as per python documentation?

Thanks in advance.

https://stackoverflow.com/questions/65802505/why-an-integer-object-is-considered-immutable-in-python January 20, 2021 at 11:04AM

没有评论:

发表评论