I am trying to use a static type checking tool to check for wrong assignment to a variable. E.g., assign a string to an int variable.
I tried pytype and mypy. Both didn't give me any warnings.
class A:
def __init__(self):
self.x : int = None
if __name__ == '__main__':
a = A()
a.x = 'abc'
print(a.x)
I expect a static type checking tool can give me a warning on the above line:
a.x = 'abc'
Do I need to use some options or other helper tools to detect this kind of assignment statement?