Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python3诅咒包装器的类型提示_Python_Visual Studio Code_Type Hinting_Curses - Fatal编程技术网

Python3诅咒包装器的类型提示

Python3诅咒包装器的类型提示,python,visual-studio-code,type-hinting,curses,Python,Visual Studio Code,Type Hinting,Curses,对于Python 3,使用curses.wrapper函数封装curses程序、处理错误和设置非常有用 导入诅咒 def干管(stdscr): #诅咒程序在这里 通过 curses.wrapper(主) 但是如何添加到stdscr对象?添加类型暗示将允许IDE为stdscr对象提供更好的智能感知,并显示可用的方法和属性。(顺便说一句,我使用的是Visual Studio代码) 以下代码: 导入诅咒 def干管(stdscr): s=str(类型(stdscr)) stdscr.clear()

对于Python 3,使用
curses.wrapper
函数封装curses程序、处理错误和设置非常有用

导入诅咒
def干管(stdscr):
#诅咒程序在这里
通过
curses.wrapper(主)
但是如何添加到
stdscr
对象?添加类型暗示将允许IDE为
stdscr
对象提供更好的智能感知,并显示可用的方法和属性。(顺便说一句,我使用的是Visual Studio代码)

以下代码:

导入诅咒
def干管(stdscr):
s=str(类型(stdscr))
stdscr.clear()
stdscr.addstr(0,0,s)
stdscr.refresh()
stdscr.getkey()
curses.wrapper(主)
…显示
类型(stdscr)

但是,这不起作用:

导入诅咒
导入诅咒
#这不起作用:
def main(stdscr:_curses.window):
#没有为stdscr提供intellisense
通过
curses.wrapper(主)

我也不确定还有什么可以尝试。

你可以通过写窗口类型的诅咒来解决这个问题。\u用引号诅咒Windows 像这样:

导入诅咒
def main(stdscr:“curses.\u CursesWindow”):
#现在intellisense将提供补全:)
通过
curses.wrapper(主)
类型暗示似乎是针对Python脚本的,而不是针对C上的精简绑定,而且您看到的是您将获得的所有内容。