As of when this issue is being written, we use type comments in our type hints, rather than the new Python type annotations:
# Conforms with our coding style
def foo(num, name):
# type: (int, str) -> str
return f"{num} is {name}'s favorite number"
# Does not conform with our coding style
def bar(num: int, name: str) -> str:
return f"{num} is {name}'s favorite number"
We have had some instances of the non-conformant form getting through code review (e.g. #3717). So that we don't need to rely on human-error-prone manual verification that we use the conformant syntax, we should introduce automated checks to enforce our preferred style.
If we change our preferred syntax before we get around to implementing this issue, then we should enforce that syntax instead.
As of when this issue is being written, we use type comments in our type hints, rather than the new Python type annotations:
We have had some instances of the non-conformant form getting through code review (e.g. #3717). So that we don't need to rely on human-error-prone manual verification that we use the conformant syntax, we should introduce automated checks to enforce our preferred style.
If we change our preferred syntax before we get around to implementing this issue, then we should enforce that syntax instead.