问题描述
我想使用Visual Studio并使用类型提示(例如在函数参数列表中)来查看智能感知,以锻炼变量的类型.
I would like to use Visual Studio and see intellisense using type hints, for example in the function argument list, to workout the type of a variable.
这可以通过isinstance(param,type)
语句来实现,但是我想知道如果不使用这些附加语句,是否可以使它工作:
This can be achieved through isinstance(param,type)
statements, but I wonder if we can get it to work without these additional statements:
注意:我已经尝试将Visual Studio与适用于Visual Studio的Python工具以及2017年初的Visual Studio Preview一起使用,该工具内置了python支持,但似乎都没有欣赏类型提示.
Note: I have tried Visual Studio with Python Tools for Visual Studio and also the early 2017 Visual Studio Preview, that has python support built in, but neither seem to appreciate type hints.
推荐答案
确认后,此结果是设计使然,请检查以下内容: Python 3.6:使用类型提示在函数参数列表中描述变量,并且此变量的快速信息显示未知类型"
After confirmed, this result is by designed, please check this: Python 3.6: using type hints to describe a variable in the function argument list and the Quick Info of this variable display ‘unknown type’
Int19h:结果是当前预期的,因为PTVS尚不支持类型提示来驱动代码完成.以下问题正在跟踪该功能:#82 .
Int19h: The result is as expected currently, because PTVS does not yet support type hints to drive code completion. The following issue is tracking that feature: #82.
这篇关于Intellisense无法识别python 3的类型提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!