Skip to content

Commit

Permalink
Docs: Update TypedDict import statements
Browse files Browse the repository at this point in the history
Since Python 3.8, `TypedDict` has been available from the `typing` module. 

As Python 3.8+ is needed to use mypy (https://github.com/python/mypy/blob/master/setup.py#L12), then it's best for the docs to reflect Python 3.8+ usage.

For previous versions, there's already a disclaimer on the page that explains that `typing_extensions` must be used: https://github.com/python/mypy/blob/master/docs/source/typed_dict.rst?plain=1#L102-L110
  • Loading branch information
rdimaio authored Feb 28, 2024
1 parent a91151c commit 6fe6a78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/source/typed_dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dictionary value depends on the key:

.. code-block:: python
from typing_extensions import TypedDict
from typing import TypedDict
Movie = TypedDict('Movie', {'name': str, 'year': int})
Expand Down Expand Up @@ -189,7 +189,7 @@ in Python 3.6 and later:

.. code-block:: python
from typing_extensions import TypedDict
from typing import TypedDict
class Movie(TypedDict):
name: str
Expand Down

0 comments on commit 6fe6a78

Please sign in to comment.