@@ -106,12 +106,16 @@ that mutable object is changed.
106
106
Types affect almost all aspects of object behavior. Even the importance of
107
107
object identity is affected in some sense: for immutable types, operations that
108
108
compute new values may actually return a reference to any existing object with
109
- the same type and value, while for mutable objects this is not allowed. E.g.,
110
- after ``a = 1; b = 1 ``, ``a `` and ``b `` may or may not refer to the same object
111
- with the value one, depending on the implementation, but after ``c = []; d =
112
- [] ``, ``c `` and ``d `` are guaranteed to refer to two different, unique, newly
113
- created empty lists. (Note that ``c = d = [] `` assigns the same object to both
114
- ``c `` and ``d ``.)
109
+ the same type and value, while for mutable objects this is not allowed.
110
+ For example, after ``a = 1; b = 1 ``, *a * and *b * may or may not refer to
111
+ the same object with the value one, depending on the implementation.
112
+ This is because :class: `int ` is an immutable type, so the reference to ``1 ``
113
+ can be reused. This behaviour depends on the implementation used, so should
114
+ not be relied upon, but is something to be aware of when making use of object
115
+ identity tests.
116
+ However, after ``c = []; d = [] ``, *c * and *d * are guaranteed to refer to two
117
+ different, unique, newly created empty lists. (Note that ``e = f = [] `` assigns
118
+ the *same * object to both *e * and *f *.)
115
119
116
120
117
121
.. _types :
0 commit comments