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