当我不小心将变量更改为不同的数据类型时,我想使用 Mypy 发出警告。但 Mypy 似乎忽略了__init__我的测试类中发生的任何事情。它还忽略对象属性对不同数据类型的更改。
__init__
最小再现器:
class Foo: blah: int def __init__(self): self.blah = 'asdf'
Mypy报告此代码没有问题。
我错过了什么吗?
python types mypy
mypy ×1
python ×1
types ×1