There was a question in cirq sync today about type annotations, which makes me think we should add some documentation about how we write type annotations in cirq. Some things to address:
- When to use a string in type annotations versus not.
- How to use
if TYPE_CHECKING.
- When to use top-level
'cirq.Foo' annotations versus a specific import from another module.
We might also want to investigate ways to have lints on type annotations because we want to prefer top-level 'cirq.Foo' annotations but we have lots of old code that doesn't do this, and no enforcement of annotation style on new code either.
There was a question in cirq sync today about type annotations, which makes me think we should add some documentation about how we write type annotations in cirq. Some things to address:
if TYPE_CHECKING.'cirq.Foo'annotations versus a specific import from another module.We might also want to investigate ways to have lints on type annotations because we want to prefer top-level
'cirq.Foo'annotations but we have lots of old code that doesn't do this, and no enforcement of annotation style on new code either.