How to make mypy complain about assigning an Any to an int
问题 mypy --strict dutifully complains about the following code: from typing import Any, Dict def main() -> None: my_str: str = 'hello' my_int: int = my_str if __name__ == "__main__": main() by outputting: error: Incompatible types in assignment (expression has type "str", variable has type "int") However the following code is accepted without any error: from typing import Any, Dict def main() -> None: my_str: Any = 'hello' my_int: int = my_str if __name__ == "__main__": main() Is there an option