pycharm: inline comment type hinting without importing the class
Answered
Hi Anna,
I'm trying to use inline comment type-hinting like
foo = None # type: com.bar.Bar
But this is not working unless I import com.foo.bar.Bar. It seems as though using the same notation in a docstring does work without the import, eg
"""
:type foo: com.bar.Bar
"""
Thanks as always!
Andy
Please sign in to leave a comment.
Hi Andy, sorry for delay with reply.
It's an expected behavior according to PEP 484. Please see Mikhael Golubev's comments from https://youtrack.jetbrains.com/issue/PY-21520 and https://youtrack.jetbrains.com/issue/PY-20485.