]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44001: improve Literal documentation (GH-25877)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Tue, 4 May 2021 08:54:12 +0000 (01:54 -0700)
committerGitHub <noreply@github.com>
Tue, 4 May 2021 08:54:12 +0000 (10:54 +0200)
Doc/library/typing.rst
Doc/whatsnew/3.10.rst
Doc/whatsnew/3.9.rst

index 8b1ce34d98ec66015ab9f6ac82c28a320642d6ed..ba79bb7ed75ff731076a4a7bf327f9fefa1f23eb 100644 (file)
@@ -799,10 +799,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
 
index eb452b07f55f612f9742370ede52a018da18beb9..3d5a188625811e8a2959a5614b957ee6a6517837 100644 (file)
@@ -1271,8 +1271,8 @@ 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`.
-   Note that declaring ``Literal`` with mutable parameters will not throw
+   equality comparisons if any of their parameters are not :term:`hashable`.
+   Note that declaring ``Literal`` with unhashable parameters will not throw
    an error::
 
       >>> from typing import Literal
index 772fb5a3fe7458a6b15c286def8cec7eaefe795d..f1725e7df022045a56f8ec42df718b174375d0f1 100644 (file)
@@ -1494,7 +1494,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::