因此,PEP 484有"The type of class objects"部分。
在本节中,声明可能存在以下情况:
U = TypeVar('U', bound=User)
def new_user(user_class: Type[U]) -> U:
user = user_class()
# (Here we could write the user object to a database)
return user
我刚刚开始使用输入模块。我的问题是,当试图找到Type提示时,我找不到它。它在源代码或文档中没有任何地方。
release notes表示输入模块实现了PEP 484.没有迹象表明实现不完整。有没有办法在当前版本上做出这种类型的提示?或者现在根本不可能?
感谢。