@@ -53,7 +53,7 @@ provides backports of these new features to older versions of Python.
5353 should broadly apply to most Python type checkers. (Some parts may still
5454 be specific to mypy.)
5555
56- `"Static Typing with Python" <https://typing.readthedocs.io /en/latest/ >`_
56+ `"Static Typing with Python" <https://typing.python.org /en/latest/ >`_
5757 Type-checker-agnostic documentation written by the community detailing
5858 type system features, useful typing related tools and typing best
5959 practices.
@@ -64,7 +64,7 @@ Specification for the Python Type System
6464========================================
6565
6666The canonical, up-to-date specification of the Python type system can be
67- found at `"Specification for the Python type system" <https://typing.readthedocs.io /en/latest/spec/index.html >`_.
67+ found at `"Specification for the Python type system" <https://typing.python.org /en/latest/spec/index.html >`_.
6868
6969.. _type-aliases :
7070
@@ -2294,17 +2294,22 @@ types.
22942294 The keyword-argument syntax is deprecated in 3.11 and will be removed
22952295 in 3.13. It may also be unsupported by static type checkers.
22962296
2297- The functional syntax should also be used when any of the keys are not valid
2298- :ref: `identifiers <identifiers >`, for example because they are keywords or contain hyphens.
2299- Example::
2297+ This functional syntax allows defining keys which are not valid
2298+ :ref: `identifiers <identifiers >`, for example because they are
2299+ keywords or contain hyphens, or when key names must not be
2300+ :ref: `mangled <private-name-mangling >` like regular private names::
23002301
23012302 # raises SyntaxError
23022303 class Point2D(TypedDict):
23032304 in: int # 'in' is a keyword
23042305 x-y: int # name with hyphens
23052306
2307+ class Definition(TypedDict):
2308+ __schema: str # mangled to `_Definition__schema`
2309+
23062310 # OK, functional syntax
23072311 Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})
2312+ Definition = TypedDict('Definition', {'__schema': str}) # not mangled
23082313
23092314 By default, all keys must be present in a ``TypedDict ``. It is possible to
23102315 mark individual keys as non-required using :data: `NotRequired `::
@@ -2600,7 +2605,7 @@ Functions and decorators
26002605
26012606 .. seealso ::
26022607 `Unreachable Code and Exhaustiveness Checking
2603- <https://typing.readthedocs.io /en/latest/guides/unreachable.html> `__ has more
2608+ <https://typing.python.org /en/latest/guides/unreachable.html> `__ has more
26042609 information about exhaustiveness checking with static typing.
26052610
26062611 .. versionadded :: 3.11
0 commit comments