Missing intellisense, autocompletion in for loop

不想你离开。 提交于 2019-12-13 00:04:28

问题


I'm doing simple for loop through my node lists.

nodeList = obj.get_nodes_list()
for node in nodeList.items:
    print node.

Node is type of V1Node and I want to access status property (field)

This is what I get in PyCharm IDE in debugging session:

And this is what I have using intellisense:

Question: Where I have all the public fields ?!


回答1:


In a debug session, PyCharm has access to the instance of an object, and can inspect and see exactly which attributes it has. When you're editing the code, PyCharm does not run anything, and can only analyze the code statically. Its capabilities to do so are limited by Python's lack of type declarations, so it's perfectly normal that it does not display all available members.

To make PyCharm's intellisense work better, you can add type hints to your code, as described in the documentation.



来源:https://stackoverflow.com/questions/52439803/missing-intellisense-autocompletion-in-for-loop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!