https://github.com/python/cpython/commit/b1c33294ca5ef8d889f2ec87f9a8fa79741f9f7d
commit: b1c33294ca5ef8d889f2ec87f9a8fa79741f9f7d
branch: main
author: Stan Ulbrych <89152624+stanfromirel...@users.noreply.github.com>
committer: kumaraditya303 <kumaradi...@python.org>
date: 2025-05-18T15:59:20Z
summary:

gh-134114: Clarify FAQ note about dictonary keys (#134118)

files:
M Doc/faq/design.rst

diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst
index e2710fab9cf800..c758c019ca437b 100644
--- a/Doc/faq/design.rst
+++ b/Doc/faq/design.rst
@@ -420,10 +420,12 @@ strings representing the files in the current directory.  
Functions which
 operate on this output would generally not break if you added another file or
 two to the directory.
 
-Tuples are immutable, meaning that once a tuple has been created, you can't
-replace any of its elements with a new value.  Lists are mutable, meaning that
-you can always change a list's elements.  Only immutable elements can be used 
as
-dictionary keys, and hence only tuples and not lists can be used as keys.
+Tuples are :term:`immutable`, meaning that once a tuple has been created, you 
can't
+replace any of its elements with a new value.  Lists are :term:`mutable`, 
meaning that
+you can always change a list's elements.  Only :term:`hashable` objects can
+be used as dictionary keys. Most immutable types are hashable, which is why
+tuples, but not lists, can be used as keys. Note, however, that a tuple is
+only hashable if all of its elements are hashable.
 
 
 How are lists implemented in CPython?

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to