File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2551,15 +2551,20 @@ types.
25512551
25522552 This functional syntax allows defining keys which are not valid
25532553 :ref: `identifiers <identifiers >`, for example because they are
2554- keywords or contain hyphens::
2554+ keywords or contain hyphens, or when key names must not be mangled
2555+ like regular private names::
25552556
25562557 # raises SyntaxError
25572558 class Point2D(TypedDict):
25582559 in: int # 'in' is a keyword
25592560 x-y: int # name with hyphens
25602561
2562+ class Definition(TypedDict):
2563+ __schema: str # mangled to `_Definition__schema`
2564+
25612565 # OK, functional syntax
25622566 Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})
2567+ Definition = TypedDict('Definition', {'__schema': str}) # not mangled
25632568
25642569 By default, all keys must be present in a ``TypedDict ``. It is possible to
25652570 mark individual keys as non-required using :data: `NotRequired `::
You can’t perform that action at this time.
0 commit comments