![](/img/trans.png)
[英]VS Code Python Intellisense and pylint not working properly
[英]Python in VS Code: IntelliSense not working properly for the object returned by the linspace function in numpy
我是 Python 新手,并尝试使用 VS 代码作为我的编辑器。
但是当我在numpy
使用linspace
函数时,IntelliSense 对于返回的对象不能正常工作。
numpy
的文档和我的示例代码的输出都显示返回对象的类型是ndarray ,但编辑器显示其类型是tuple 。 所以IntelliSense不能提示ndarray类型相关的属性和方法,有点烦。
我的示例代码如下
import numpy as np
a = np.linspace(0, 1, num=5)
print(type(a))
输出是:
而VS代码显示:
我应该如何解决这个问题? 谢谢。
在VSCode中,这里的鼠标悬停提示是由不同的语言服务提供的,通常显示的是基本的数据类型,( Number, String, List, Tuple, Set, Dictionary
),这里的“type(a)”是封装的类在 numpy 中,返回的“ numpy.ndarray ”是类,而不是基本数据类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.