@@ -35,12 +35,19 @@ represented by objects.)
3535 Every object has an identity, a type and a value. An object's *identity * never
3636changes once it has been created; you may think of it as the object's address in
3737memory. The ':keyword: `is `' operator compares the identity of two objects; the
38- :func: `id ` function returns an integer representing its identity (currently
39- implemented as its address). An object's :dfn: `type ` is also unchangeable. [# ]_
38+ :func: `id ` function returns an integer representing its identity.
39+
40+ .. impl-detail ::
41+
42+ For CPython, ``id(x) `` is the memory address where ``x `` is stored.
43+
4044An object's type determines the operations that the object supports (e.g., "does
4145it have a length?") and also defines the possible values for objects of that
4246type. The :func: `type ` function returns an object's type (which is an object
43- itself). The *value * of some objects can change. Objects whose value can
47+ itself). Like its identity, an object's :dfn: `type ` is also unchangeable.
48+ [# ]_
49+
50+ The *value * of some objects can change. Objects whose value can
4451change are said to be *mutable *; objects whose value is unchangeable once they
4552are created are called *immutable *. (The value of an immutable container object
4653that contains a reference to a mutable object can change when the latter's value
@@ -1258,7 +1265,12 @@ Basic customization
12581265
12591266 User-defined classes have :meth: `__eq__ ` and :meth: `__hash__ ` methods
12601267 by default; with them, all objects compare unequal (except with themselves)
1261- and ``x.__hash__() `` returns ``id(x) ``.
1268+ and ``x.__hash__() `` returns an appropriate value such that ``x == y ``
1269+ implies both that ``x is y `` and ``hash(x) == hash(y) ``.
1270+
1271+ .. impl-detail ::
1272+
1273+ CPython uses ``hash(id(x)) `` as the default hash for class instances.
12621274
12631275 Classes which inherit a :meth: `__hash__ ` method from a parent class but
12641276 change the meaning of :meth: `__eq__ ` such that the hash value returned is no
0 commit comments