防止隐式转换

问题描述

类似于 this question,Mypy 中是否有防止隐式强制转换的方法?例如,强制转换为 bool:

x = (0,0)

def is_good() -> bool:
    return False

if x and is_good:  # I'd like Mypy to report 2 errors here
    print('this will be printed')

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)