`__getattr__` and pytype checking
Open
- Dominant language
- Jupyter Notebook
- Stars
- 7.3k
- Forks
- 833
- Avg merge
- 5h 11m
- Merged PRs (30d)
- 5
Description
Currently `nn.Module` implement `__getattr__`. This disable any type checking when making a typo in attribute:
```python
my_module = MyModule()
my_module.non_existing_attribute # << pytype do not detect this
```
It would be nice to wrap `__getattr__` in a `if not typing.TYPE_CHECKING:` so that pytype actually check the attribute types.
Note that `class Module` would have to be updated so that the `Module` fields are defined (note doing this today would also allow type checking on `module.scope`,...):
```python
class Module:
scope: Optional[Scope]
```
Contributor guide
Assessment
This issue has not been assessed yet.