Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec: mutable types are unhashable even when frozen #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ look up the value for a key, or to remove an element. Dictionaries
are implemented using hash tables, so keys must be hashable. Hashable
values include `None`, Booleans, numbers, and strings, and tuples
composed from hashable values. Most mutable values, such as lists,
and dictionaries, are not hashable, unless they are frozen.
and dictionaries, are not hashable.
Attempting to use a non-hashable value as a key in a dictionary
results in a dynamic error.

Expand Down Expand Up @@ -1425,8 +1425,7 @@ A hashable value has the same hash throughout its lifetime.
Values of the types `NoneType`, `bool`, `int`, `float`, and `string`,
which are all immutable, are hashable.

Values of mutable types such as `list` and `dict` are not
hashable, unless they have become immutable due to _freezing_.
Values of mutable types such as `list` and `dict` are not hashable.

A `tuple` value is hashable only if all its elements are hashable.
Thus `("localhost", 80)` is hashable but `([127, 0, 0, 1], 80)` is not.
Expand Down