代码之家  ›  专栏  ›  技术社区  ›  Steve B.

mypy strict不检测布尔值,返回“no any return”

  •  -1
  • Steve B.  · 技术社区  · 3 年前

    对于以下函数

        def __eq__(self, other: object) -> bool:
            if not isinstance(other, Node):
                return False
            return other.address == self.address
    

    mypy正在报道 error: Returning Any from function declared to return "bool" [no-any-return] 这似乎很奇怪,因为这两条语句似乎都明确地返回布尔值。有人能解释一下吗?

    谢谢

    0 回复  |  直到 3 年前