Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 275 Bytes

File metadata and controls

17 lines (13 loc) · 275 Bytes

Does a "with" statement support type hinting?

PEP 526, which has been implemented in Python 3.6, allows you to annotate variables. You can use, for example,

x: str
with example() as x:
    [...]

or

with example() as x:
    x: str
    [...]