Ignore handled exceptions in `try` blocks
I have the following code which returns as attribute-error unless silenced:
def __eq__(self, value: object) -> bool:
"""Dice are equal if they give the same probabilities."""
try:
return self.probabilities == value.probabilities # pytype: disable=attribute-error
except AttributeError:
return False
As handling attribute and type issues is a common case for try: ... except: blocks it would be great if pytype automatically ignored type errors which were specifically handled in the code.
@MusicalNinjaDad
I hope it works
def eq(self, value: object) -> bool: """Dice are equal if they give the same probabilities.""" try: return self.probabilities == value.probabilities # pytype: disable=attribute-error except AttributeError: return False
your code was not Indented
Hi, thank you for your report. Google is shifting its effort to a different approach for type checking apart from pytype, and we're not planning to put in any effort in the near future in pytype, so we'll close this issue. Please see the announcement here.