Questions tagged «mypy»

2
如何在类型提示中指定函数类型?
我想在当前的Python 3.5项目中使用类型提示。我的函数应该接收一个函数作为参数。 如何在类型提示中指定类型函数? import typing def my_function(name:typing.AnyStr, func: typing.Function) -> None: # However, typing.Function does not exist. # How can I specify the type function for the parameter `func`? # do some processing pass 我检查了PEP 483,但在那里找不到函数类型提示。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.