Internal state

changing the data inside the object is called modifying the internal state of the object, the state(data) is changed, but memory address has not changed

Mutable

an object whose internal state can be changed

  • Lists, Sets, Dictionarys, User-defined Classes

Immutable

an object whose internal state can not be changed

  • Numbers(int, float, Booleans), String, Tuples, Frozen Sets, User-defined Classes
  • variable re-assignment change the reference not the internal value

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。