Pycharm: Code completion not giving recommendations

后端 未结 5 2021
攒了一身酷
攒了一身酷 2020-12-01 09:56

Say I\'m working with the \'requests\' python library.

req = requests.get(\"http://google.com\")

Now after this, if I type req.

5条回答
  •  有刺的猬
    2020-12-01 10:17

    Python is a dynamically typed language, which means that the "get" function does not declare its return type. When you're entering code in IPython or in the PyCharm console, the code is actually being executed, and it's possible to inspect the object instance in the running interpreter and to get the list of its methods. When you're entering code in PyCharm or in any other Python IDE, it is not executed, and it's only possible to use static analysis to infer the return type of the method. This is not possible in all cases.

提交回复
热议问题