syntax error warning for type hinting annotation with pycharm

Answered

I'm writing a code for type hinting annotation with pycharm such like 

    def run() -> list:

In my env, this is warned for a syntax error with a comment

"illegal target for variable annotation"

However, it is able to run and the syntax seems correct.

How to suppress this warning?

 

My pycharm is 2017.1.
My python env is the anaconda env with python 3.6 on windows 10,

4 comments

Hello, thank you for the report.

Could you please attach a screenshot that shows the problem?

0

I'm seeing a similar issue.

The entire function call for setup() is highlighted with the "Illegal target for variable annotation" warning.

0

I'm very sorry for not responding.

However, I met this problem again. 

The interpreter is Python 3.7 and turned editor>inspections>python>code compatibility inspection off. 

Do you have any idea to solve it?

 

 

0

Hi @Yatzhash

I suggest reporting it to issue tracker (https://youtrack.jetbrains.com/issues/PY), providing the minimal code snippet to reproduce>

0

Please sign in to leave a comment.