Skip to content

Commit 27f3f7d

Browse files
Reword
1 parent 71cf4dd commit 27f3f7d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Doc/faq/design.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,10 @@ two to the directory.
422422

423423
Tuples are immutable, meaning that once a tuple has been created, you can't
424424
replace any of its elements with a new value. Lists are mutable, meaning that
425-
you can always change a list's elements. Only immutable elements can be used as
426-
dictionary keys, and hence only tuples and not lists can be used as keys.
425+
you can always change a list's elements. Only hashable objects can be used as
426+
dictionary keys. Most immutable types are hashable, which is why tuples, but
427+
not lists, can be used as keys. Note, however, that a tuple is only hashable
428+
if all of its elements are hashable.
427429

428430

429431
How are lists implemented in CPython?

0 commit comments

Comments
 (0)