Skip to content

Commit 2046fb3

Browse files
bpo-44001: improve Literal documentation (GH-25877) (#25882)
(cherry picked from commit 87109f4) Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent 20380df commit 2046fb3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Doc/library/typing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,10 @@ These can be used as types in annotations using ``[]``, each having a unique syn
799799
.. versionadded:: 3.8
800800

801801
.. versionchanged:: 3.9.1
802-
``Literal`` now de-duplicates parameters. Equality comparison of
802+
``Literal`` now de-duplicates parameters. Equality comparisons of
803803
``Literal`` objects are no longer order dependent. ``Literal`` objects
804804
will now raise a :exc:`TypeError` exception during equality comparisons
805-
if one of their parameters are not :term:`immutable`.
805+
if one of their parameters are not :term:`hashable`.
806806

807807
.. data:: ClassVar
808808

Doc/whatsnew/3.10.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,8 @@ and to match the behavior of static type checkers specified in the PEP.
12711271
now ``False``. To support this change, the internally used type cache now
12721272
supports differentiating types.
12731273
4. ``Literal`` objects will now raise a :exc:`TypeError` exception during
1274-
equality comparisons if one of their parameters are not :term:`immutable`.
1275-
Note that declaring ``Literal`` with mutable parameters will not throw
1274+
equality comparisons if any of their parameters are not :term:`hashable`.
1275+
Note that declaring ``Literal`` with unhashable parameters will not throw
12761276
an error::
12771277
12781278
>>> from typing import Literal

Doc/whatsnew/3.9.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ and to match the behavior of static type checkers specified in the PEP.
14941494
now ``False``. To support this change, the internally used type cache now
14951495
supports differentiating types.
14961496
4. ``Literal`` objects will now raise a :exc:`TypeError` exception during
1497-
equality comparisons if one of their parameters are not :term:`immutable`.
1497+
equality comparisons if any of their parameters are not :term:`hashable`.
14981498
Note that declaring ``Literal`` with mutable parameters will not throw
14991499
an error::
15001500

0 commit comments

Comments
 (0)