[Python-checkins] [3.9] bpo-44001: improve Literal documentation (GH-25877). (#25897)
ambv
webhook-mailer at python.org
Tue May 4 12:48:49 EDT 2021
https://github.com/python/cpython/commit/ab0a54adad8ddf488ccfb92970be9e4027673d19
commit: ab0a54adad8ddf488ccfb92970be9e4027673d19
branch: 3.9
author: Jelle Zijlstra <jelle.zijlstra at gmail.com>
committer: ambv <lukasz at langa.pl>
date: 2021-05-04T18:48:41+02:00
summary:
[3.9] bpo-44001: improve Literal documentation (GH-25877). (#25897)
(cherry picked from commit 87109f4d85c93a870ee8aa0d2b394547d4636b17)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>
files:
M Doc/library/typing.rst
M Doc/whatsnew/3.9.rst
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index b136da00a070ad..06a8b813c2b44b 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -656,10 +656,10 @@ These can be used as types in annotations using ``[]``, each having a unique syn
.. versionadded:: 3.8
.. versionchanged:: 3.9.1
- ``Literal`` now de-duplicates parameters. Equality comparison of
+ ``Literal`` now de-duplicates parameters. Equality comparisons of
``Literal`` objects are no longer order dependent. ``Literal`` objects
will now raise a :exc:`TypeError` exception during equality comparisons
- if one of their parameters are not :term:`immutable`.
+ if one of their parameters are not :term:`hashable`.
.. data:: ClassVar
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index cb492e458c6daa..7f790e5bd7555e 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -1493,7 +1493,7 @@ and to match the behavior of static type checkers specified in the PEP.
now ``False``. To support this change, the internally used type cache now
supports differentiating types.
4. ``Literal`` objects will now raise a :exc:`TypeError` exception during
- equality comparisons if one of their parameters are not :term:`immutable`.
+ equality comparisons if any of their parameters are not :term:`hashable`.
Note that declaring ``Literal`` with mutable parameters will not throw
an error::
More information about the Python-checkins
mailing list