Skip to content

bpo-44001: improve Literal documentation #25877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down