I want to annotate a type of a variable in a for
-loop.
I tried this:
for i: int in range(5):
pass
But it didn't work, obviously.
What I expect is working autocomplete in PyCharm 2016.3.2.
Pre-annotation like this:
i: int
for i in range(5):
pass
doesn't help.
P.S. Pre-annotation works for PyCharm >= 2017.1
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…