[3.9] bpo-44001: improve Literal documentation (GH-25877). (#25897)

(cherry picked from commit 87109f4d85)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Jelle Zijlstra 2021-05-04 09:48:41 -07:00 committed by GitHub
parent ec18362f6a
commit ab0a54adad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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::