mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
bpo-37051: Refine note on what objects are hashable (GH-13587)
This commit is contained in:
parent
02db696732
commit
cc1c582f6f
1 changed files with 4 additions and 2 deletions
|
@ -512,8 +512,10 @@ Glossary
|
||||||
Hashability makes an object usable as a dictionary key and a set member,
|
Hashability makes an object usable as a dictionary key and a set member,
|
||||||
because these data structures use the hash value internally.
|
because these data structures use the hash value internally.
|
||||||
|
|
||||||
All of Python's immutable built-in objects are hashable; mutable
|
Most of Python's immutable built-in objects are hashable; mutable
|
||||||
containers (such as lists or dictionaries) are not. Objects which are
|
containers (such as lists or dictionaries) are not; immutable
|
||||||
|
containers (such as tuples and frozensets) are only hashable if
|
||||||
|
their elements are hashable. Objects which are
|
||||||
instances of user-defined classes are hashable by default. They all
|
instances of user-defined classes are hashable by default. They all
|
||||||
compare unequal (except with themselves), and their hash value is derived
|
compare unequal (except with themselves), and their hash value is derived
|
||||||
from their :func:`id`.
|
from their :func:`id`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue