If I have a key in a dictionary with an invalid identifier, such as A(2). How can I create a TypedDict with this field?
E.g
from typing import TypedDict
class RandomAlphabet(TypedDict):
A(2): str
is not valid Python code, resulting in the error:
SyntaxError: illegal target for annotation
The same problem is with reserved keywords:
class RandomAlphabet(TypedDict):
return: str
throws:
SyntaxError: invalid syntax