What is the theory behind mutable and immutable types?

后端 未结 4 1030
甜味超标
甜味超标 2021-02-04 03:53

One of the things that I admire about Python is its distinction between mutable and immutable types. Having spent a while programming in c before coming to Python, I was astonis

4条回答
  •  名媛妹妹
    2021-02-04 04:28

    Objective C is loaded with mutable/immutable distinctions (to the point where there are both NSString and NSMutableString, for example); it predates Python by about 8 years. Smalltalk, from which Objective C inherited much of its OO design, uses the concept to a lesser extent (notably, strings are not immutable; the trend these days is towards immutable strings as in Python, Ruby, etc.).

提交回复
热议问题