PEP 526, which has been implemented in Python 3.6, allows you to annotate variables. The variable used in a with
statement can be annotated like this:
x: str
with example() as x:
[...]
PEP 526, which has been implemented in Python 3.6, allows you to annotate variables. The variable used in a with
statement can be annotated like this:
x: str
with example() as x:
[...]