# type: a
On Sun, 15 Sep 2019 at 16:53, Hongyi Zhao <hongyi.zhao at gmail.com> wrote:
> In pycharm? when I commented out the following line:
> # type: a
> The pycharm still told me that:
> Unresolved reference 'a'
PyCharm interprets PEP 484 type annotations and type comments, as well
as PEP 526 variable annotations. The comment you wrote is a type
comment that says 'a' is the expected type of something. The 'type:'
part is special here, `# foo: a` won?t trigger this warning. PyCharm
expects stuff in type comments to exist, because otherwise, there?s no
way to know what type you mean.
Type comments are now best replaced by Python 3.6+ variable
annotations, but the comments are still valid, and can be used in some
contexts where annotations are not supported.
Chris Warrick <https://chriswarrick.com/>