# type: a

MRAB python at mrabarnett.plus.com
Sun Sep 15 11:36:22 EDT 2019


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.



More information about the Python-list mailing list