osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

# type: a


On 2019-09-15 15:45, Hongyi Zhao wrote:
> Hi,
> 
> In pycharm? when I commented out the following line:
> 
> # type: a
> 
> The pycharm still told me that:
> 
> Unresolved reference 'a'
> 
> Till I commented like the following, the warning will disappear:
> 
> # type: # a
> 
> 
> Why?
> 
PyCharm has comment-based type hints, and:

# type: a

looks to PyCharm like such a type hint, so it looks for the name 'a', 
but doesn't find it.

Adding the second # stops it looking like a type hint.