Python打字提示亚型
我有一个类型的对象dict [str,Union [str [str,dict [str,str]]]
,该>正在将其附加到类型list的Python列表中联合[str,dict [str,可选[Union [str,bool]]]]]]
。 Mypy为此引起了错误。
我意识到这是Mypy不接受str
作为可选[Union [str,bool]]
的一部分。有解决方法吗?
I have an object of the type Dict[str, Union[str, Dict[str, str]]]
, which is being appended into a Python list of type List[Dict[str, Union[str, Dict[str, Optional[Union[str, bool]]]]]]
. Mypy raises an error for this.
I realize that this is Mypy not accepting str
as being part of Optional[Union[str, bool]]
. Is there some workaround to this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论