We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 71cf4dd commit 27f3f7dCopy full SHA for 27f3f7d
Doc/faq/design.rst
@@ -422,8 +422,10 @@ two to the directory.
422
423
Tuples are immutable, meaning that once a tuple has been created, you can't
424
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.
+you can always change a list's elements. Only hashable objects can be used as
+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.
429
430
431
How are lists implemented in CPython?
0 commit comments